]> 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:08:26 +0000 (14:08 +0200)
commit7aa46ac359d3484d7c87703a35f1a5e7201398ed
treefa469406f3d2c77074d4c223fe3a615703f0584b
parente7320147cf6184ecb88cad9b36c8a2d0f9164c43
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