]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
nvme-auth: use kvfree() for memory allocated with kvcalloc()
authorIsrael Rukshin <israelr@nvidia.com>
Sun, 23 Nov 2025 14:46:48 +0000 (16:46 +0200)
committerKeith Busch <kbusch@kernel.org>
Thu, 4 Dec 2025 22:46:17 +0000 (14:46 -0800)
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/auth.c

index a01178caf15bb5e9e16295822f85ba11152c691c..8f3ccb317e4de61d21704210dcf3f8629d68f71c 100644 (file)
@@ -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);