linux-yocto/drivers/block
Sarah Newman 57418de354 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-28 16:25:51 +02:00
..
aoe aoe: defer rexmit timer downdev work to workqueue 2025-07-10 15:59:50 +02:00
drbd drbd: add missing kref_get in handle_write_conflicts 2025-08-28 16:25:51 +02:00
mtip32xx
null_blk null_blk: Fix return value of nullb_device_power_store() 2024-11-22 15:37:35 +01:00
paride
rnbd block/rnbd-srv: Check for unlikely string overflow 2024-02-05 20:12:52 +00:00
xen-blkback
zram zram: fix potential UAF of zram table 2025-01-23 17:17:13 +01:00
amiflop.c
ataflop.c
brd.c brd: defer automatic disk creation until module initialization succeeds 2024-12-14 19:53:14 +01:00
floppy.c
Kconfig
loop.c loop: aio inherit the ioprio of original request 2025-05-02 07:47:07 +02:00
Makefile
n64cart.c
nbd.c nbd: fix uaf in nbd_genl_connect() error path 2025-07-17 18:32:11 +02:00
pktcdvd.c
ps3disk.c
ps3vram.c
rbd_types.h
rbd.c rbd: don't assume RBD_LOCK_STATE_LOCKED for exclusive mappings 2024-08-03 08:49:45 +02:00
sunvdc.c sunvdc: Balance device refcount in vdc_port_mpgroup_check 2025-08-28 16:25:49 +02:00
swim_asm.S
swim.c
swim3.c
ublk_drv.c ublk: use vmalloc for ublk_device's __queues 2025-08-15 12:04:52 +02:00
virtio_blk.c virtio-blk: don't keep queue frozen during system suspend 2025-01-02 10:30:52 +01:00
xen-blkfront.c
z2ram.c