linux-yocto/drivers/block
Sarah Newman 84ef8dd323 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:24:16 +02:00
..
aoe aoe: avoid potential deadlock at set_capacity 2025-07-17 18:30:48 +02:00
drbd drbd: add missing kref_get in handle_write_conflicts 2025-08-28 16:24:16 +02:00
mtip32xx block: fix surprise removal for drivers calling blk_set_queue_dying 2022-02-23 12:03:15 +01:00
null_blk null_blk: fix validation of block size 2024-07-27 10:46:09 +02:00
paride pcd: fix error codes in pcd_init_unit() 2023-09-19 12:23:04 +02:00
rnbd block/rnbd-srv: Check for unlikely string overflow 2024-02-23 08:54:43 +01:00
rsxx block: handle bio_split_to_limits() NULL return 2023-01-18 11:48:58 +01:00
xen-blkback xen-blkback: Advertise feature-persistent as user requested 2022-09-08 12:28:05 +02:00
zram zram: refuse to use zero sized block device as backing device 2025-01-09 13:28:34 +01:00
amiflop.c block: drop unused includes in <linux/genhd.h> 2022-03-16 14:23:46 +01:00
ataflop.c block: drop unused includes in <linux/genhd.h> 2022-03-16 14:23:46 +01:00
brd.c brd: defer automatic disk creation until module initialization succeeds 2024-12-14 19:50:42 +01:00
cryptoloop.c
floppy.c floppy: Fix memory leak in do_floppy_init() 2022-12-31 13:14:47 +01:00
Kconfig remove the sx8 block driver 2023-06-14 11:12:59 +02:00
loop.c loop: aio inherit the ioprio of original request 2025-05-02 07:44:38 +02:00
loop.h
Makefile remove the sx8 block driver 2023-06-14 11:12:59 +02:00
n64cart.c block: rename GENHD_FL_NO_PART_SCAN to GENHD_FL_NO_PART 2023-09-19 12:23:02 +02:00
nbd.c nbd: fix uaf in nbd_genl_connect() error path 2025-07-17 18:30:52 +02:00
pktcdvd.c block: handle bio_split_to_limits() NULL return 2023-01-18 11:48:58 +01:00
ps3disk.c
ps3vram.c block: handle bio_split_to_limits() NULL return 2023-01-18 11:48:58 +01:00
rbd_types.h
rbd.c rbd: don't assume RBD_LOCK_STATE_LOCKED for exclusive mappings 2024-08-19 05:45:22 +02:00
sunvdc.c sunvdc: Balance device refcount in vdc_port_mpgroup_check 2025-08-28 16:24:15 +02:00
swim_asm.S
swim.c block: drop unused includes in <linux/genhd.h> 2022-03-16 14:23:46 +01:00
swim3.c
virtio_blk.c virtio-blk: don't keep queue frozen during system suspend 2025-01-09 13:28:40 +01:00
xen-blkfront.c xen/blkfront: Only check REQ_FUA for writes 2023-06-21 15:59:13 +02:00
z2ram.c