]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
nvmet-tcp: add bounds checks in nvmet_tcp_build_pdu_iovec
authorYunJe Shin <yjshin0438@gmail.com>
Wed, 28 Jan 2026 00:41:07 +0000 (09:41 +0900)
committerKeith Busch <kbusch@kernel.org>
Thu, 5 Feb 2026 15:29:10 +0000 (07:29 -0800)
commit52a0a98549344ca20ad81a4176d68d28e3c05a5c
tree09fc8b4daf23a0bce36d3c71a29832d9477f277c
parent071be3b0b6575d45be9df9c5b612f5882bfc5e88
nvmet-tcp: add bounds checks in nvmet_tcp_build_pdu_iovec

nvmet_tcp_build_pdu_iovec() could walk past cmd->req.sg when a PDU
length or offset exceeds sg_cnt and then use bogus sg->length/offset
values, leading to _copy_to_iter() GPF/KASAN. Guard sg_idx, remaining
entries, and sg->length/offset before building the bvec.

Fixes: 872d26a391da ("nvmet-tcp: add NVMe over TCP target driver")
Signed-off-by: YunJe Shin <ioerts@kookmin.ac.kr>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Joonkyo Jung <joonkyoj@yonsei.ac.kr>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/tcp.c