]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nvme-pci: use sgls for all user requests if possible
authorKeith Busch <kbusch@kernel.org>
Fri, 8 Nov 2024 23:41:08 +0000 (15:41 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 12:02:01 +0000 (13:02 +0100)
commit3c63fb6ef7f387ce8fbc0d952dc6179b75068a9a
tree3196678e8a88964529d2c9ea5fa30ceba885dc28
parent595a5b23eb72f16c4adf0eb9a048af82b2fdec24
nvme-pci: use sgls for all user requests if possible

[ Upstream commit 6fad84a4d624c300d03ebba457cc641765050c43 ]

If the device supports SGLs, use these for all user requests. This
format encodes the expected transfer length so it can catch short buffer
errors in a user command, whether it occurred accidently or maliciously.

For controllers that support SGL data mode, this is a viable mitigation
to CVE-2023-6238. For controllers that don't support SGLs, log a warning
in the passthrough path since not having the capability can corrupt
data if the interface is not used correctly.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Stable-dep-of: 00817f0f1c45 ("nvme-ioctl: fix leaked requests on mapping error")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/ioctl.c
drivers/nvme/host/pci.c