]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
dmaengine: idxd: fix memory leak in error handling path of idxd_setup_engines
authorShuai Xue <xueshuai@linux.alibaba.com>
Fri, 4 Apr 2025 12:02:10 +0000 (20:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 May 2025 12:12:23 +0000 (14:12 +0200)
commit9ba964b17fca8f42c17e64522935870b165c4c5e
treeb7ed3883e0668606db94114e0e00e375a7d2dba0
parent47846211998a9ffb0fcc08092eb95ac783d2b11a
dmaengine: idxd: fix memory leak in error handling path of idxd_setup_engines

commit 817bced19d1dbdd0b473580d026dc0983e30e17b upstream.

Memory allocated for engines is not freed if an error occurs during
idxd_setup_engines(). To fix it, free the allocated memory in the
reverse order of allocation before exiting the function in case of an
error.

Fixes: 75b911309060 ("dmaengine: idxd: fix engine conf_dev lifetime")
Cc: stable@vger.kernel.org
Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Fenghua Yu <fenghuay@nvidia.com>
Link: https://lore.kernel.org/r/20250404120217.48772-3-xueshuai@linux.alibaba.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/dma/idxd/init.c