Skip to content

Commit 8f0edf4

Browse files
keithbuschChristoph Hellwig
authored andcommitted
nvme-pci: fix freeing single sgl
There may only be a single DMA mapped entry from multiple physical segments, which means we don't allocate a separte SGL list. Check the number of allocations prior to know if we need to free something. Freeing a single list allocation is the same for both PRP and SGL usages, so we don't need to check the use_sgl flag anymore. Fixes: 01df742 ("nvme-pci: remove SGL segment descriptors") Reported-by: Niklas Schnelle <[email protected]> Signed-off-by: Keith Busch <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Tested-by: Niklas Schnelle <[email protected]>
1 parent 2f1e07d commit 8f0edf4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/nvme/host/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ static void nvme_unmap_data(struct nvme_dev *dev, struct request *req)
556556
if (iod->nr_allocations == 0)
557557
dma_pool_free(dev->prp_small_pool, iod->list[0].sg_list,
558558
iod->first_dma);
559-
else if (iod->use_sgl)
559+
else if (iod->nr_allocations == 1)
560560
dma_pool_free(dev->prp_page_pool, iod->list[0].sg_list,
561561
iod->first_dma);
562562
else

0 commit comments

Comments
 (0)