Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nvme-auth: use kvfree() for memory allocated with kvcalloc()

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>

authored by

Israel Rukshin and committed by
Keith Busch
bb9f4cca 5c8d134f

+1 -1
+1 -1
drivers/nvme/host/auth.c
··· 1122 1122 if (ctrl->dhchap_ctxs) { 1123 1123 for (i = 0; i < ctrl_max_dhchaps(ctrl); i++) 1124 1124 nvme_auth_free_dhchap(&ctrl->dhchap_ctxs[i]); 1125 - kfree(ctrl->dhchap_ctxs); 1125 + kvfree(ctrl->dhchap_ctxs); 1126 1126 } 1127 1127 if (ctrl->host_key) { 1128 1128 nvme_auth_free_key(ctrl->host_key);