From: francis.p@samsung.com
To: kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me
Cc: linux-nvme@lists.infradead.org, anshul@samsung.com,
jg123.choi@samsung.com, prakash.bv@samsung.com,
d.palani@samsung.com, sathya.m@samsung.com,
Francis Pravin <francis.p@samsung.com>
Subject: [PATCH] nvme-pci: use correct size to free the hmb buffer
Date: Fri, 10 Jan 2025 05:21:37 +0530 [thread overview]
Message-ID: <20250109235137.8995-1-francis.p@samsung.com> (raw)
In-Reply-To: CGME20250110051900epcas5p12cd1640b8e8d7a64680c5130091ad6e6@epcas5p1.samsung.com
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
next parent reply other threads:[~2025-01-10 7:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250110051900epcas5p12cd1640b8e8d7a64680c5130091ad6e6@epcas5p1.samsung.com>
2025-01-09 23:51 ` francis.p [this message]
2025-01-10 10:02 ` [PATCH] nvme-pci: use correct size to free the hmb buffer Christoph Hellwig
2025-01-10 22:50 ` Sagi Grimberg
2025-01-11 3:56 ` Keith Busch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250109235137.8995-1-francis.p@samsung.com \
--to=francis.p@samsung.com \
--cc=anshul@samsung.com \
--cc=axboe@fb.com \
--cc=d.palani@samsung.com \
--cc=hch@lst.de \
--cc=jg123.choi@samsung.com \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=prakash.bv@samsung.com \
--cc=sagi@grimberg.me \
--cc=sathya.m@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox