]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: venus: vdec: fixed possible memory leak issue
authorAmeer Hamza <amhamza.mgc@gmail.com>
Mon, 6 Dec 2021 10:43:15 +0000 (11:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:51:47 +0000 (19:51 +0100)
commit5cedfe8aaf1875a5305897107b7f298db4260019
treed46b7ae96834ebebb5facba8d4b327a7fa2b9ac6
parentd3717cf6baa41ea6f784d130a6b7d80c19d62099
media: venus: vdec: fixed possible memory leak issue

commit 8403fdd775858a7bf04868d43daea0acbe49ddfc upstream.

The venus_helper_alloc_dpb_bufs() implementation allows an early return
on an error path when checking the id from ida_alloc_min() which would
not release the earlier buffer allocation.

Move the direct kfree() from the error checking of dma_alloc_attrs() to
the common fail path to ensure that allocations are released on all
error paths in this function.

Addresses-Coverity: 1494120 ("Resource leak")

cc: stable@vger.kernel.org # 5.16+
Fixes: 40d87aafee29 ("media: venus: vdec: decoded picture buffer handling during reconfig sequence")
Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/platform/qcom/venus/helpers.c