summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorWentao Liang <vulab@iscas.ac.cn>2026-09-17 10:12:22 +0000
committerHans Verkuil <hverkuil+cisco@kernel.org>2026-09-23 14:54:50 +0200
commitb00fbdad64d4ea7d594bc67988c1722fe5b3be50 (patch)
treedcdbf28de4ec3b5a7e748712b5f60bc019648ad7 /drivers
parent7b7a69c91c0537d48150942d9707614a4fdd3766 (diff)
media: vpif_capture: Fix i2c adapter reference leak in vpif_probe()
vpif_probe() takes a reference to the i2c adapter with i2c_get_adapter() and passes it to v4l2_i2c_new_subdev_board(), which does not consume it, but the reference is never released, so it is leaked both when the probe succeeds and when it fails after the adapter has been acquired. Release the reference with i2c_put_adapter() on the success path and in the probe_subdev_out cleanup, and initialise i2c_adap so that the cleanup is a no-op when the adapter was never acquired. Fixes: 6ffefff5a9e7 ("V4L/DVB (12906c): V4L : vpif capture driver for DM6467") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/platform/ti/davinci/vpif_capture.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/platform/ti/davinci/vpif_capture.c b/drivers/media/platform/ti/davinci/vpif_capture.c
index 91cb6223561a..397f3115af5b 100644
--- a/drivers/media/platform/ti/davinci/vpif_capture.c
+++ b/drivers/media/platform/ti/davinci/vpif_capture.c
@@ -1602,7 +1602,7 @@ err_cleanup:
static int vpif_probe(struct platform_device *pdev)
{
struct vpif_subdev_info *subdevdata;
- struct i2c_adapter *i2c_adap;
+ struct i2c_adapter *i2c_adap = NULL;
int subdev_count;
int res_idx = 0;
int i, err;
@@ -1692,9 +1692,12 @@ static int vpif_probe(struct platform_device *pdev)
}
}
+ i2c_put_adapter(i2c_adap);
+
return 0;
probe_subdev_out:
+ i2c_put_adapter(i2c_adap);
v4l2_async_nf_cleanup(&vpif_obj.notifier);
/* free sub devices memory */
kfree(vpif_obj.sd);