summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorShivam Kumar <kumar.shivam43666@gmail.com>2026-08-14 15:48:11 -0400
committerKeith Busch <kbusch@kernel.org>2026-09-03 14:15:10 -0700
commit14cc5a7e77731497d5bea70f3bb05df7eda982e4 (patch)
tree7e253323f552e625eb564e693d3e01f38f079d19 /scripts
parentdf7197ebc7280be9f34dfee9757a933ef0b18741 (diff)
downloadlinux-14cc5a7e77731497d5bea70f3bb05df7eda982e4.tar.gz
linux-14cc5a7e77731497d5bea70f3bb05df7eda982e4.zip
nvmet-tcp: fix out-of-bounds write when receiving an over-long PDU
nvmet_tcp_try_recv_pdu() reads a PDU header into the fixed 128-byte queue->pdu union, then computes the remaining payload length as queue->left = hdr->hlen - queue->offset + hdgst; and reads that many more bytes into &queue->pdu + queue->offset, without ever bounding the result against sizeof(queue->pdu). A struct nvme_tcp_icreq_pdu is itself 128 bytes, exactly the size of the union. Once a header digest has been negotiated (hdgst = 4), a second ICReq passes the hlen == nvmet_tcp_pdu_size() check but yields queue->left = 128 - 8 + 4 = 124, so bytes 8..132 are written into the 128-byte buffer -- 4 bytes past its end, over queue->hdr_digest and queue->data_digest. Those bytes are attacker-controlled (an ICReq carries no digest), and the duplicate ICReq is only rejected later, after the overflow. A remote unauthenticated host can thus corrupt kernel memory adjacent to the receive buffer. Reject any PDU whose declared length would read past the end of queue->pdu before the second recv. Fixes: 872d26a391da ("nvmet-tcp: add NVMe over TCP target driver") Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Shivam Kumar <kumar.shivam43666@gmail.com> Cc: stable@vger.kernel.org Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions