linux-yocto/drivers/block
Sarah Newman 7d483ad300 drbd: add missing kref_get in handle_write_conflicts
[ Upstream commit 00c9c9628b ]

With `two-primaries` enabled, DRBD tries to detect "concurrent" writes
and handle write conflicts, so that even if you write to the same sector
simultaneously on both nodes, they end up with the identical data once
the writes are completed.

In handling "superseeded" writes, we forgot a kref_get,
resulting in a premature drbd_destroy_device and use after free,
and further to kernel crashes with symptoms.

Relevance: No one should use DRBD as a random data generator, and apparently
all users of "two-primaries" handle concurrent writes correctly on layer up.
That is cluster file systems use some distributed lock manager,
and live migration in virtualization environments stops writes on one node
before starting writes on the other node.

Which means that other than for "test cases",
this code path is never taken in real life.

FYI, in DRBD 9, things are handled differently nowadays.  We still detect
"write conflicts", but no longer try to be smart about them.
We decided to disconnect hard instead: upper layers must not submit concurrent
writes. If they do, that's their fault.

Signed-off-by: Sarah Newman <srn@prgmr.com>
Signed-off-by: Lars Ellenberg <lars@linbit.com>
Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Link: https://lore.kernel.org/r/20250627095728.800688-1-christoph.boehmwalder@linbit.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-20 18:30:20 +02:00
..
aoe aoe: defer rexmit timer downdev work to workqueue 2025-07-10 16:05:07 +02:00
drbd drbd: add missing kref_get in handle_write_conflicts 2025-08-20 18:30:20 +02:00
mtip32xx
null_blk block: add a rq_list type 2025-04-25 10:48:06 +02:00
rnbd
xen-blkback
zram zram: fix potential UAF of zram table 2025-01-23 17:22:58 +01:00
amiflop.c
ataflop.c
brd.c brd: fix discard end sector 2025-06-19 15:31:28 +02:00
floppy.c
Kconfig
loop.c loop: Avoid updating block size under exclusive owner 2025-08-20 18:30:20 +02:00
Makefile
n64cart.c
nbd.c nbd: fix uaf in nbd_genl_connect() error path 2025-07-17 18:37:17 +02:00
pktcdvd.c
ps3disk.c ps3disk: Do not use dev->bounce_size before it is set 2025-02-08 09:56:51 +01:00
ps3vram.c
rbd_types.h
rbd.c
rnull.rs rust: treewide: switch to our kernel Box type 2025-03-13 13:01:44 +01:00
sunvdc.c sunvdc: Balance device refcount in vdc_port_mpgroup_check 2025-08-20 18:30:15 +02:00
swim_asm.S
swim.c
swim3.c
ublk_drv.c ublk: use vmalloc for ublk_device's __queues 2025-08-15 12:13:32 +02:00
virtio_blk.c block: don't reorder requests in blk_add_rq_to_plug 2025-04-25 10:48:06 +02:00
xen-blkfront.c
z2ram.c