linux/drivers/staging
Dawei Feng 9df2fbe563 media: cedrus: fix memory leak in cedrus_init_ctrls()
In cedrus_init_ctrls(), the V4L2 control handler is initialized before
allocating memory for ctx->ctrls. If this allocation fails, the function
returns -ENOMEM without freeing the previously allocated handler
resources, leading to a memory leak.

Fix this by calling v4l2_ctrl_handler_free() on the ctx->ctrls allocation
failure path.

The bug was first flagged by an experimental analysis tool we are
developing for kernel memory-management bugs while analyzing
v6.13-rc1. The tool is still under development and is not yet publicly
available. Manual inspection confirms that the bug is still
present in v7.1.1.

An x86_64 allyesconfig build showed no new warnings. As we do not have an
Allwinner SoC or board with a Cedrus VPU available to test with, no
runtime testing was able to be performed.

Fixes: 50e761516f ("media: platform: Add Cedrus VPU decoder driver")
Cc: stable@vger.kernel.org
Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2026-07-17 12:36:48 +02:00
..
axis-fifo staging: axis-fifo: refactor device tree parsing 2026-02-23 15:45:31 +01:00
fbtft staging: fbtft: remove unused function fbtft_write_gpio16_wr_latched 2026-05-04 16:49:10 +02:00
greybus Staging driver updates for 7.2-rc1 2026-06-22 12:43:16 -07:00
iio staging: iio: Use named initializers for struct i2c_device_id 2026-05-31 11:01:46 +01:00
media media: cedrus: fix memory leak in cedrus_init_ctrls() 2026-07-17 12:36:48 +02:00
most staging: most: video: avoid double free on video register failure 2026-05-21 12:42:38 +02:00
nvec staging: nvec: fix unconditional pm_power_off teardown 2026-05-04 16:17:10 +02:00
octeon staging: octeon: replace pr_warn with dev_warn in fill and rx paths 2026-05-21 11:20:45 +02:00
rtl8723bs Staging driver updates for 7.2-rc1 2026-06-22 12:43:16 -07:00
sm750fb staging: sm750: rename CamelCase variable Bpp to bpp 2026-05-21 12:41:39 +02:00
vc04_services Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
vme_user staging: vme_user: simplify boolean comparisons 2026-05-11 09:51:05 +02:00
Kconfig staging: gpib: Destage gpib 2025-11-24 17:52:11 +01:00
Makefile staging: gpib: Destage gpib 2025-11-24 17:52:11 +01:00