Repository navigation
Conversation
|
Upstream branch: 0fcb05b |
e6ca2c1 to
3d027d5
Compare
|
Upstream branch: 58161ea |
820dcd2 to
be05164
Compare
3d027d5 to
90ea7e4
Compare
|
Upstream branch: c03c1a1 |
be05164 to
b90aea2
Compare
90ea7e4 to
435b194
Compare
|
Upstream branch: 7be4bc5 |
b90aea2 to
6e1bff8
Compare
435b194 to
fd67522
Compare
|
Upstream branch: 17bb0e2 |
6e1bff8 to
60d06c1
Compare
fd67522 to
3b53a63
Compare
|
Upstream branch: 21a7f44 |
60d06c1 to
c96b068
Compare
3b53a63 to
5d84576
Compare
|
Upstream branch: 6b4b543 |
c96b068 to
71bf901
Compare
5d84576 to
6582ed2
Compare
|
Upstream branch: fb2c3f4 |
71bf901 to
5cab3e4
Compare
6582ed2 to
b3a1abc
Compare
|
Upstream branch: d135ab4 |
5cab3e4 to
83fe410
Compare
b3a1abc to
712496f
Compare
|
Upstream branch: c339f40 |
83fe410 to
2a399e4
Compare
712496f to
a186880
Compare
|
Upstream branch: d89e1d1 |
2a399e4 to
1d53022
Compare
a186880 to
46206a3
Compare
|
Upstream branch: 6628e7d |
1d53022 to
65b7443
Compare
46206a3 to
220bd96
Compare
|
Upstream branch: 05441d6 |
65b7443 to
986f16c
Compare
220bd96 to
6c4625e
Compare
|
Upstream branch: f66469d |
986f16c to
93438f2
Compare
6c4625e to
c7f678d
Compare
|
Upstream branch: d487237 |
93438f2 to
dbccb74
Compare
c7f678d to
6aa6cd1
Compare
A node that reads from its peer (it has no local disk, the area is not up to date locally, or read-balancing chose the peer) sends a P_DATA_REQUEST for req->i.size bytes, and recv_dless_read() copies the matching P_DATA_REPLY into the original bio. Commit bd910a7 ("drbd: reject data replies with an out-of-range payload size") rejects a negative payload size, but a reply that is shorter or longer than the request is still accepted. A shorter reply only fills the start of the bio. data_size still drops to zero in the copy loop, so the final D_ASSERT() does not fire, and the read completes successfully although the rest of the caller's buffer was never written. With a proxy that cut one reply down to 1 KiB, a 4 KiB O_DIRECT read returned 4096 with the last 3 KiB of the buffer unchanged and nothing in the kernel log. A longer reply leaves the excess in the socket, where it is parsed as the next packet header. A correct peer always replies with exactly the requested size. Reject any other size, as is already done for negative sizes. Fixes: b411b36 ("The DRBD driver") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Yibo Liu <yiboliume@gmail.com>
receive_DataRequest() takes the digest length of P_CSUM_RS_REQUEST and P_OV_REPLY packets from the packet header and passes it to kmalloc() without any check. The worker later compares the received digest with one computed by the local csums or verify algorithm. A size mismatch is only reported by D_ASSERT(), and memcmp() runs anyway. A digest that is shorter than the algorithm's digest size therefore makes w_e_end_csum_rs_req() and w_e_end_ov_reply() read past the end of the digest_info allocation: BUG: KASAN: slab-out-of-bounds in memcmp+0x1b8/0x1d8 Read of size 8 at addr ffff00000a638610 by task drbd_w_r1/212 Call trace: memcmp w_e_end_csum_rs_req drbd_worker Allocated by task 240: __kmalloc_noprof receive_DataRequest drbd_receiver A digest length larger than the page allocator can serve triggers the WARN_ON_ONCE() for oversized allocations, as GFP_NOIO does not include __GFP_NOWARN: WARNING: mm/page_alloc.c:5340 at __alloc_frozen_pages_noprof Call trace: ___kmalloc_large_node __kmalloc_noprof receive_DataRequest drbd_receiver Reject these packets unless the digest length matches the digest size of the configured csums or verify algorithm, and also reject them when no such algorithm is configured. In the worker, only compare digests of the same size: the peer can switch csums-alg or verify-alg with P_SYNC_PARAM after the request was received, and a size mismatch is then treated as "not in sync" instead of reading out of bounds. Fixes: b411b36 ("The DRBD driver") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Yibo Liu <yiboliume@gmail.com>
|
Upstream branch: b3dfbde |
dbccb74 to
64d1f7b
Compare
Pull request for series with
subject: drbd: validate payload sizes received from the peer
version: 1
url: https://patchwork.kernel.org/series/1186806/