]> www.infradead.org Git - users/hch/misc.git/commit
nvme-pci: fix freeing of the HMB descriptor table
authorChristoph Hellwig <hch@lst.de>
Tue, 29 Oct 2024 04:03:09 +0000 (05:03 +0100)
committerChristoph Hellwig <hch@lst.de>
Tue, 29 Oct 2024 04:44:23 +0000 (05:44 +0100)
commit385dda09d7e8370ee0cc29a9d435ceca6f51dbf0
treec39ddeb3087392f13fa0858be5f67a09eac85b17
parent5e52f71f858eaff252a47530a5ad5e79309bd415
nvme-pci: fix freeing of the HMB descriptor table

The HMB descriptor table is sized to the maximum number of descriptors
that could be used for a given device, but __nvme_alloc_host_mem could
break out of the loop earlier on memory allocation failure and end up
using less descriptors than planned for, which leads to an incorrect
size passed to dma_free_coherent.

In practice this was not showing up because the number of descriptors
tends to be low and the dma coherent allocator always allocates and
frees at least a page.

Fixes: 87ad72a59a38 ("nvme-pci: implement host memory buffer support")
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/pci.c