Message ID | 20250601224231.24317-2-qasdev00@gmail.com |
---|---|
State | New |
Headers | show |
Series | dmaengine: qcom_hidma: fix memory leak issues | expand |
On 6/2/25 01:42, Qasim Ijaz wrote: > hidma_ll_init() is invoked to create and initialise a struct hidma_lldev > object during hidma probe. During this a FIFO buffer is allocated, but > if some failure occurs after (like hidma_ll_setup failure) we should > clean up the FIFO. > > Fixes: d1615ca2e085 ("dmaengine: qcom_hidma: implement lower level hardware interface") > Cc: stable@vger.kernel.org > Signed-off-by: Qasim Ijaz <qasdev00@gmail.com> Reviewed-by: Eugen Hristev <eugen.hristev@linaro.org>
diff --git a/drivers/dma/qcom/hidma_ll.c b/drivers/dma/qcom/hidma_ll.c index 53244e0e34a3..fee448499777 100644 --- a/drivers/dma/qcom/hidma_ll.c +++ b/drivers/dma/qcom/hidma_ll.c @@ -788,8 +788,10 @@ struct hidma_lldev *hidma_ll_init(struct device *dev, u32 nr_tres, return NULL; rc = hidma_ll_setup(lldev); - if (rc) + if (rc) { + kfifo_free(&lldev->handoff_fifo); return NULL; + } spin_lock_init(&lldev->lock); tasklet_setup(&lldev->task, hidma_ll_tre_complete);
hidma_ll_init() is invoked to create and initialise a struct hidma_lldev object during hidma probe. During this a FIFO buffer is allocated, but if some failure occurs after (like hidma_ll_setup failure) we should clean up the FIFO. Fixes: d1615ca2e085 ("dmaengine: qcom_hidma: implement lower level hardware interface") Cc: stable@vger.kernel.org Signed-off-by: Qasim Ijaz <qasdev00@gmail.com> --- drivers/dma/qcom/hidma_ll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)