linux/drivers/nvme
Keith Busch f3ed399e9a nvme-pci: handle changing device dma map requirements
[ Upstream commit 071be3b0b6 ]

The initial state of dma_needs_unmap may be false, but change to true
while mapping the data iterator. Enabling swiotlb is one such case that
can change the result. The nvme driver needs to save the mapped dma
vectors to be unmapped later, so allocate as needed during iteration
rather than assume it was always allocated at the beginning. This fixes
a NULL dereference from accessing an uninitialized dma_vecs when the
device dma unmapping requirements change mid-iteration.

Fixes: b8b7570a7e ("nvme-pci: fix dma unmapping when using PRPs and not using the IOVA mapping")
Link: https://lore.kernel.org/linux-nvme/20260202125738.1194899-1-pradeep.pragallapati@oss.qualcomm.com/
Reported-by: Pradeep P V K <pradeep.pragallapati@oss.qualcomm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-02-11 13:41:59 +01:00
..
common nvme-auth: use hkdf_expand_label() 2025-09-15 16:42:07 -07:00
host nvme-pci: handle changing device dma map requirements 2026-02-11 13:41:59 +01:00
target nvmet-tcp: fixup hang in nvmet_tcp_listen_data_ready() 2026-02-11 13:41:51 +01:00
Kconfig nvme: implement In-Band authentication 2022-08-02 17:14:49 -06:00
Makefile nvme: common: make keyring and auth separate modules 2023-11-07 10:05:15 -08:00