]> 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:10:07 +0000 (14:10 +0200)
commit11fd63ea08b9ff18a9020bf48be2aee34920590d
tree282b1379f64cfff3a9c73f8fc2a21aff67a1c6a3
parentd584acdf54f409cb7eae1359ae6c12aaabedeed8
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