]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nvme-tcp: fix potential memory corruption in nvme_tcp_recv_pdu()
authorMaurizio Lombardi <mlombard@redhat.com>
Wed, 26 Feb 2025 13:42:18 +0000 (14:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 12:02:03 +0000 (13:02 +0100)
commit9fbc953d6b38bc824392e01850f0aeee3b348722
tree2476918d56675862da2994f19012357715f875d2
parent0ff76a25ab0c3448ce671d4657a0e04636c8ef8b
nvme-tcp: fix potential memory corruption in nvme_tcp_recv_pdu()

[ Upstream commit ad95bab0cd28ed77c2c0d0b6e76e03e031391064 ]

nvme_tcp_recv_pdu() doesn't check the validity of the header length.
When header digests are enabled, a target might send a packet with an
invalid header length (e.g. 255), causing nvme_tcp_verify_hdgst()
to access memory outside the allocated area and cause memory corruptions
by overwriting it with the calculated digest.

Fix this by rejecting packets with an unexpected header length.

Fixes: 3f2304f8c6d6 ("nvme-tcp: add NVMe over TCP host driver")
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/tcp.c