* [PATCH] nvme-pci: use correct size to free the hmb buffer [not found] <CGME20250110051900epcas5p12cd1640b8e8d7a64680c5130091ad6e6@epcas5p1.samsung.com> @ 2025-01-09 23:51 ` francis.p 2025-01-10 10:02 ` Christoph Hellwig ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: francis.p @ 2025-01-09 23:51 UTC (permalink / raw) To: kbusch, axboe, hch, sagi Cc: linux-nvme, anshul, jg123.choi, prakash.bv, d.palani, sathya.m, Francis Pravin From: Francis Pravin <francis.p@samsung.com> dev->host_mem_size value is updated only after the successful buffer allocation of hmb descriptor. Otherwise, it may have some undefined value. So, use the correct size to free the hmb buffer when the hmb descriptor buffer allocation failed. Signed-off-by: Francis Pravin <francis.p@samsung.com> --- drivers/nvme/host/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index e2634f437f33..6c119499c5db 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2086,8 +2086,8 @@ static int nvme_alloc_host_mem_single(struct nvme_dev *dev, u64 size) sizeof(*dev->host_mem_descs), &dev->host_mem_descs_dma, GFP_KERNEL); if (!dev->host_mem_descs) { - dma_free_noncontiguous(dev->dev, dev->host_mem_size, - dev->hmb_sgt, DMA_BIDIRECTIONAL); + dma_free_noncontiguous(dev->dev, size, dev->hmb_sgt, + DMA_BIDIRECTIONAL); dev->hmb_sgt = NULL; return -ENOMEM; } -- 2.43.5 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] nvme-pci: use correct size to free the hmb buffer 2025-01-09 23:51 ` [PATCH] nvme-pci: use correct size to free the hmb buffer francis.p @ 2025-01-10 10:02 ` Christoph Hellwig 2025-01-10 22:50 ` Sagi Grimberg 2025-01-11 3:56 ` Keith Busch 2 siblings, 0 replies; 4+ messages in thread From: Christoph Hellwig @ 2025-01-10 10:02 UTC (permalink / raw) To: francis.p Cc: kbusch, axboe, hch, sagi, linux-nvme, anshul, jg123.choi, prakash.bv, d.palani, sathya.m Looks good: Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nvme-pci: use correct size to free the hmb buffer 2025-01-09 23:51 ` [PATCH] nvme-pci: use correct size to free the hmb buffer francis.p 2025-01-10 10:02 ` Christoph Hellwig @ 2025-01-10 22:50 ` Sagi Grimberg 2025-01-11 3:56 ` Keith Busch 2 siblings, 0 replies; 4+ messages in thread From: Sagi Grimberg @ 2025-01-10 22:50 UTC (permalink / raw) To: francis.p, kbusch, axboe, hch Cc: linux-nvme, anshul, jg123.choi, prakash.bv, d.palani, sathya.m Reviewed-by: Sagi Grimberg <sagi@grimberg.me> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nvme-pci: use correct size to free the hmb buffer 2025-01-09 23:51 ` [PATCH] nvme-pci: use correct size to free the hmb buffer francis.p 2025-01-10 10:02 ` Christoph Hellwig 2025-01-10 22:50 ` Sagi Grimberg @ 2025-01-11 3:56 ` Keith Busch 2 siblings, 0 replies; 4+ messages in thread From: Keith Busch @ 2025-01-11 3:56 UTC (permalink / raw) To: francis.p Cc: axboe, hch, sagi, linux-nvme, anshul, jg123.choi, prakash.bv, d.palani, sathya.m On Fri, Jan 10, 2025 at 05:21:37AM +0530, francis.p@samsung.com wrote: > From: Francis Pravin <francis.p@samsung.com> > > dev->host_mem_size value is updated only after the successful buffer > allocation of hmb descriptor. Otherwise, it may have some undefined value. > So, use the correct size to free the hmb buffer when the hmb descriptor > buffer allocation failed. Thanks, applied to nvme-6.14. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-01-11 3:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20250110051900epcas5p12cd1640b8e8d7a64680c5130091ad6e6@epcas5p1.samsung.com>
2025-01-09 23:51 ` [PATCH] nvme-pci: use correct size to free the hmb buffer francis.p
2025-01-10 10:02 ` Christoph Hellwig
2025-01-10 22:50 ` Sagi Grimberg
2025-01-11 3:56 ` Keith Busch
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox