linux/drivers/block/drbd
Michael Bommarito bd910a7660 drbd: reject data replies with an out-of-range payload size
recv_dless_read() receives a P_DATA_REPLY from a peer into the bio of an
outstanding read request. The peer-supplied payload length reaches it as
the signed int data_size, and two peer-controlled inputs can make it
negative. With a negotiated data-integrity-alg the digest length is
subtracted first, so a reply whose payload is smaller than the digest
underflows data_size. With no integrity algorithm (the default) data_size
is assigned from the unsigned h95/h100 wire length and drbdd() never
bounds it for a payload-carrying command, so a length above INT_MAX casts
it negative; this path needs no non-default feature. The bio receive loop
then computes expect = min_t(int, data_size, bv_len), which is negative,
and drbd_recv_all_warn(mapped, expect) receives with a size_t of SIZE_MAX
into the first mapped page.

The sibling receive path read_in_block() is not affected: it uses an
unsigned size and rejects it against DRBD_MAX_BIO_SIZE before receiving.
Reject a data reply whose size is negative after the optional digest
subtraction, covering both triggers.

Impact: a malicious or man-in-the-middle DRBD peer copies attacker-chosen
bytes past a bio page in the receiver, corrupting kernel memory. A node
that reads from its peer (a diskless node, or read-balancing to the peer)
is exposed in the default configuration; data-integrity-alg is not
required.

Fixes: b411b3637f ("The DRBD driver")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5-5-xhigh
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
Reviewed-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Link: https://patch.msgid.link/20260710022837.3738461-1-michael.bommarito@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-07-10 06:49:11 -06:00
..
drbd_actlog.c drbd: fix "LOGIC BUG" in drbd_al_begin_io_nonblock() 2026-02-19 08:21:53 -07:00
drbd_bitmap.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
drbd_buildtag.c drbd: move UAPI headers to include/uapi/linux/ 2026-05-08 19:23:23 -06:00
drbd_config.h drbd: move UAPI headers to include/uapi/linux/ 2026-05-08 19:23:23 -06:00
drbd_debugfs.c drbd: replace genl_magic with explicit netlink serialization 2026-05-08 19:23:23 -06:00
drbd_debugfs.h drbd: use consistent license 2022-11-22 19:38:39 -07:00
drbd_int.h drbd: replace genl_magic with explicit netlink serialization 2026-05-08 19:23:23 -06:00
drbd_interval.c drbd: drbd_insert_interval(): Clarify comment 2023-01-29 15:18:33 -07:00
drbd_interval.h drbd: fix "LOGIC BUG" in drbd_al_begin_io_nonblock() 2026-02-19 08:21:53 -07:00
drbd_main.c drbd: replace genl_magic with explicit netlink serialization 2026-05-08 19:23:23 -06:00
drbd_nl_gen.c drbd: replace genl_magic with explicit netlink serialization 2026-05-08 19:23:23 -06:00
drbd_nl_gen.h drbd: replace genl_magic with explicit netlink serialization 2026-05-08 19:23:23 -06:00
drbd_nl.c drbd: replace genl_magic with explicit netlink serialization 2026-05-08 19:23:23 -06:00
drbd_polymorph_printk.h drbd: add context parameter to expect() macro 2022-12-01 11:33:49 -07:00
drbd_proc.c drbd: replace genl_magic with explicit netlink serialization 2026-05-08 19:23:23 -06:00
drbd_protocol.h drbd: use consistent license 2022-11-22 19:38:39 -07:00
drbd_receiver.c drbd: reject data replies with an out-of-range payload size 2026-07-10 06:49:11 -06:00
drbd_req.c drbd: fix null-pointer dereference on local read error 2026-02-20 07:09:06 -07:00
drbd_req.h drbd: pass drbd_peer_device to __req_mod 2023-04-01 20:27:55 -06:00
drbd_state_change.h drbd: fix function cast warnings in state machine 2024-02-13 08:55:40 -07:00
drbd_state.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
drbd_state.h drbd: use consistent license 2022-11-22 19:38:39 -07:00
drbd_strings.c drbd: use consistent license 2022-11-22 19:38:39 -07:00
drbd_strings.h drbd: use consistent license 2022-11-22 19:38:39 -07:00
drbd_vli.h drbd: remove unnecessary assignment in vli_encode_bits 2023-01-29 15:18:33 -07:00
drbd_worker.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
Kconfig lib/crc: remove CONFIG_LIBCRC32C 2025-04-04 11:31:42 -07:00
Makefile drbd: replace genl_magic with explicit netlink serialization 2026-05-08 19:23:23 -06:00