public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] nvme-auth: Use kvfree() for memory allocated with kvcalloc()
@ 2025-11-23 14:46 Israel Rukshin
  2025-11-24  6:23 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Israel Rukshin @ 2025-11-23 14:46 UTC (permalink / raw)
  To: Linux-nvme, Sagi Grimberg, Christoph Hellwig, Keith Busch,
	Jens Axboe
  Cc: Israel Rukshin, Nitzan Carmi, Max Gurtovoy

Memory allocated by kvcalloc() may come from vmalloc or kmalloc,
so use kvfree() instead of kfree() for proper deallocation.

Fixes: aa36d711e945 ("nvme-auth: convert dhchap_auth_list to an array")
Signed-off-by: Israel Rukshin <israelr@nvidia.com>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
---
 drivers/nvme/host/auth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
index a01178caf15b..8f3ccb317e4d 100644
--- a/drivers/nvme/host/auth.c
+++ b/drivers/nvme/host/auth.c
@@ -1122,7 +1122,7 @@ void nvme_auth_free(struct nvme_ctrl *ctrl)
 	if (ctrl->dhchap_ctxs) {
 		for (i = 0; i < ctrl_max_dhchaps(ctrl); i++)
 			nvme_auth_free_dhchap(&ctrl->dhchap_ctxs[i]);
-		kfree(ctrl->dhchap_ctxs);
+		kvfree(ctrl->dhchap_ctxs);
 	}
 	if (ctrl->host_key) {
 		nvme_auth_free_key(ctrl->host_key);
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme-auth: Use kvfree() for memory allocated with kvcalloc()
  2025-11-23 14:46 [PATCH] nvme-auth: Use kvfree() for memory allocated with kvcalloc() Israel Rukshin
@ 2025-11-24  6:23 ` Christoph Hellwig
  2025-11-24 19:35 ` Keith Busch
  2025-11-30 22:53 ` Sagi Grimberg
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2025-11-24  6:23 UTC (permalink / raw)
  To: Israel Rukshin
  Cc: Linux-nvme, Sagi Grimberg, Christoph Hellwig, Keith Busch,
	Jens Axboe, Nitzan Carmi, Max Gurtovoy

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme-auth: Use kvfree() for memory allocated with kvcalloc()
  2025-11-23 14:46 [PATCH] nvme-auth: Use kvfree() for memory allocated with kvcalloc() Israel Rukshin
  2025-11-24  6:23 ` Christoph Hellwig
@ 2025-11-24 19:35 ` Keith Busch
  2025-11-30 22:53 ` Sagi Grimberg
  2 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2025-11-24 19:35 UTC (permalink / raw)
  To: Israel Rukshin
  Cc: Linux-nvme, Sagi Grimberg, Christoph Hellwig, Jens Axboe,
	Nitzan Carmi, Max Gurtovoy

On Sun, Nov 23, 2025 at 04:46:48PM +0200, Israel Rukshin wrote:
> Memory allocated by kvcalloc() may come from vmalloc or kmalloc,
> so use kvfree() instead of kfree() for proper deallocation.

Thanks, applied to nvme-6.19.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme-auth: Use kvfree() for memory allocated with kvcalloc()
  2025-11-23 14:46 [PATCH] nvme-auth: Use kvfree() for memory allocated with kvcalloc() Israel Rukshin
  2025-11-24  6:23 ` Christoph Hellwig
  2025-11-24 19:35 ` Keith Busch
@ 2025-11-30 22:53 ` Sagi Grimberg
  2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2025-11-30 22:53 UTC (permalink / raw)
  To: Israel Rukshin, Linux-nvme, Christoph Hellwig, Keith Busch,
	Jens Axboe
  Cc: Nitzan Carmi, Max Gurtovoy

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-30 22:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-23 14:46 [PATCH] nvme-auth: Use kvfree() for memory allocated with kvcalloc() Israel Rukshin
2025-11-24  6:23 ` Christoph Hellwig
2025-11-24 19:35 ` Keith Busch
2025-11-30 22:53 ` Sagi Grimberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox