drbd: reject oversized DataReply before signed conversion
Subsystems (2)
PATCH 1/1 drbd: reject oversized DataReply before signed conversion
From: Tianchu Chen <[email protected]>
Discovered by Atuin - Automated Vulnerability Discovery Engine.
Reject DataReply payload lengths that cannot fit in recv_dless_read()'s signed size argument so a bogus remote peer cannot wrap the length negative and turn it into a huge heap OOB-write.
--- drivers/block/drbd/drbd_receiver.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/block/drbd/drbd_receiver.c +4 -0
@@ -24,6 +24,7 @@#include <linux/memcontrol.h> #include <linux/mm_inline.h> #include <linux/slab.h> +#include <linux/limits.h> #include <uapi/linux/sched/types.h> #include <linux/sched/signal.h> #include <linux/pkt_sched.h>
@@ -1947,6 +1948,9 @@ static int receive_DataReply(struct drbd_connection *connection, struct packet_iif (unlikely (!req))return -EIO ; +if (pi->size >INT_MAX ) +return -EINVAL ; + err =recv_dless_read (peer_device, req, sector, pi->size);if (!err)req_mod (req,DATA_RECEIVED , peer_device);
Signature · 1 line
2.51.0
Christoph Böhmwalder
maintainerQuoted 11 lines · Tianchu Chen
From: Tianchu Chen <[email protected]>
Discovered by Atuin - Automated Vulnerability Discovery Engine.
Reject DataReply payload lengths that cannot fit in recv_dless_read()'s signed size argument so a bogus remote peer cannot wrap the length negative and turn it into a huge heap OOB-write.
Fixes b411b3637fa7 ("The DRBD driver")Signed-off-by Tianchu Chen <[email protected]>
This is similar to [0], but the mentioned patch is a more complete fix. There is also a case in recv_dless_read where data_size can underflow when a data-integrity-alg is configured.
The other patch catches this case as well by placing the guard later, so I would prefer to apply that one instead of this.
Thanks,
Christoph