mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/5] media: i2c: Add missing v4l2_subdev_cleanup() calls
@ 2026-09-09  8:02 Aleksandr Chubuchnyi
  2026-09-09  8:02 ` [PATCH 1/5] media: i2c: imx296: Add missing v4l2_subdev_cleanup() call Aleksandr Chubuchnyi
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Aleksandr Chubuchnyi @ 2026-09-09  8:02 UTC (permalink / raw)
  To: sakari.ailus, laurent.pinchart, mchehab, mani, michael.riesch,
	jacopo.mondi, nicholas, benjamin.mugnier, sylvain.petinot
  Cc: linux-media, linux-kernel

v4l2_subdev_init_finalize() allocates the subdev active state and only
v4l2_subdev_cleanup() frees it. These five drivers never call it, so they
leak the state on every unbind.

Separate patches because the Fixes tags span 2022 to 2023 and go to
different stable trees. The st-mipid02 one dates from the active state
conversion, not from the original driver.

Aleksandr Chubuchnyi (5):
  media: i2c: imx296: Add missing v4l2_subdev_cleanup() call
  media: i2c: imx415: Add missing v4l2_subdev_cleanup() call
  media: i2c: mt9m114: Add missing v4l2_subdev_cleanup() calls
  media: i2c: ov8858: Add missing v4l2_subdev_cleanup() call
  media: i2c: st-mipid02: Add missing v4l2_subdev_cleanup() call

 drivers/media/i2c/imx296.c     | 1 +
 drivers/media/i2c/imx415.c     | 1 +
 drivers/media/i2c/mt9m114.c    | 2 ++
 drivers/media/i2c/ov8858.c     | 2 ++
 drivers/media/i2c/st-mipid02.c | 2 ++
 5 files changed, 8 insertions(+)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] media: i2c: imx296: Add missing v4l2_subdev_cleanup() call
  2026-09-09  8:02 [PATCH 0/5] media: i2c: Add missing v4l2_subdev_cleanup() calls Aleksandr Chubuchnyi
@ 2026-09-09  8:02 ` Aleksandr Chubuchnyi
  2026-09-09  8:02 ` [PATCH 2/5] media: i2c: imx415: " Aleksandr Chubuchnyi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Aleksandr Chubuchnyi @ 2026-09-09  8:02 UTC (permalink / raw)
  To: sakari.ailus, laurent.pinchart, mchehab, mani, michael.riesch,
	jacopo.mondi, nicholas, benjamin.mugnier, sylvain.petinot
  Cc: linux-media, linux-kernel, stable

The subdev active state allocated by v4l2_subdev_init_finalize() is leaked
on unbind.

Fixes: cb33db2b6ccf ("media: i2c: IMX296 camera sensor driver")
Cc: stable@vger.kernel.org
Signed-off-by: Aleksandr Chubuchnyi <chubuchnyi@gmail.com>
---
 drivers/media/i2c/imx296.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/imx296.c b/drivers/media/i2c/imx296.c
index 69636db11..855137b5a 100644
--- a/drivers/media/i2c/imx296.c
+++ b/drivers/media/i2c/imx296.c
@@ -870,6 +870,7 @@ static int imx296_subdev_init(struct imx296 *sensor)
 
 static void imx296_subdev_cleanup(struct imx296 *sensor)
 {
+	v4l2_subdev_cleanup(&sensor->subdev);
 	media_entity_cleanup(&sensor->subdev.entity);
 	v4l2_ctrl_handler_free(&sensor->ctrls);
 }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/5] media: i2c: imx415: Add missing v4l2_subdev_cleanup() call
  2026-09-09  8:02 [PATCH 0/5] media: i2c: Add missing v4l2_subdev_cleanup() calls Aleksandr Chubuchnyi
  2026-09-09  8:02 ` [PATCH 1/5] media: i2c: imx296: Add missing v4l2_subdev_cleanup() call Aleksandr Chubuchnyi
@ 2026-09-09  8:02 ` Aleksandr Chubuchnyi
  2026-09-09  8:02 ` [PATCH 3/5] media: i2c: mt9m114: Add missing v4l2_subdev_cleanup() calls Aleksandr Chubuchnyi
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Aleksandr Chubuchnyi @ 2026-09-09  8:02 UTC (permalink / raw)
  To: sakari.ailus, laurent.pinchart, mchehab, mani, michael.riesch,
	jacopo.mondi, nicholas, benjamin.mugnier, sylvain.petinot
  Cc: linux-media, linux-kernel, stable

The subdev active state allocated by v4l2_subdev_init_finalize() is leaked
on unbind.

Fixes: 14cd15e7a1e2 ("media: i2c: add imx415 cmos image sensor driver")
Cc: stable@vger.kernel.org
Signed-off-by: Aleksandr Chubuchnyi <chubuchnyi@gmail.com>
---
 drivers/media/i2c/imx415.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/imx415.c b/drivers/media/i2c/imx415.c
index c3b22b238..12c2f3df6 100644
--- a/drivers/media/i2c/imx415.c
+++ b/drivers/media/i2c/imx415.c
@@ -1125,6 +1125,7 @@ static int imx415_subdev_init(struct imx415 *sensor)
 
 static void imx415_subdev_cleanup(struct imx415 *sensor)
 {
+	v4l2_subdev_cleanup(&sensor->subdev);
 	media_entity_cleanup(&sensor->subdev.entity);
 	v4l2_ctrl_handler_free(&sensor->ctrls);
 }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/5] media: i2c: mt9m114: Add missing v4l2_subdev_cleanup() calls
  2026-09-09  8:02 [PATCH 0/5] media: i2c: Add missing v4l2_subdev_cleanup() calls Aleksandr Chubuchnyi
  2026-09-09  8:02 ` [PATCH 1/5] media: i2c: imx296: Add missing v4l2_subdev_cleanup() call Aleksandr Chubuchnyi
  2026-09-09  8:02 ` [PATCH 2/5] media: i2c: imx415: " Aleksandr Chubuchnyi
@ 2026-09-09  8:02 ` Aleksandr Chubuchnyi
  2026-09-09  8:02 ` [PATCH 4/5] media: i2c: ov8858: Add missing v4l2_subdev_cleanup() call Aleksandr Chubuchnyi
  2026-09-09  8:02 ` [PATCH 5/5] media: i2c: st-mipid02: " Aleksandr Chubuchnyi
  4 siblings, 0 replies; 6+ messages in thread
From: Aleksandr Chubuchnyi @ 2026-09-09  8:02 UTC (permalink / raw)
  To: sakari.ailus, laurent.pinchart, mchehab, mani, michael.riesch,
	jacopo.mondi, nicholas, benjamin.mugnier, sylvain.petinot
  Cc: linux-media, linux-kernel, stable

The subdev active state allocated by v4l2_subdev_init_finalize() is leaked
on unbind, for both the pixel array and the image flow processor subdev.

Fixes: 24d756e914fc ("media: i2c: Add driver for onsemi MT9M114 camera sensor")
Cc: stable@vger.kernel.org
Signed-off-by: Aleksandr Chubuchnyi <chubuchnyi@gmail.com>
---
 drivers/media/i2c/mt9m114.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/i2c/mt9m114.c b/drivers/media/i2c/mt9m114.c
index 848ea06e7..137e8e6df 100644
--- a/drivers/media/i2c/mt9m114.c
+++ b/drivers/media/i2c/mt9m114.c
@@ -1482,6 +1482,7 @@ static int mt9m114_pa_init(struct mt9m114 *sensor)
 
 static void mt9m114_pa_cleanup(struct mt9m114 *sensor)
 {
+	v4l2_subdev_cleanup(&sensor->pa.sd);
 	v4l2_ctrl_handler_free(&sensor->pa.hdl);
 	media_entity_cleanup(&sensor->pa.sd.entity);
 }
@@ -2208,6 +2209,7 @@ static int mt9m114_ifp_init(struct mt9m114 *sensor)
 
 static void mt9m114_ifp_cleanup(struct mt9m114 *sensor)
 {
+	v4l2_subdev_cleanup(&sensor->ifp.sd);
 	v4l2_ctrl_handler_free(&sensor->ifp.hdl);
 	media_entity_cleanup(&sensor->ifp.sd.entity);
 }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/5] media: i2c: ov8858: Add missing v4l2_subdev_cleanup() call
  2026-09-09  8:02 [PATCH 0/5] media: i2c: Add missing v4l2_subdev_cleanup() calls Aleksandr Chubuchnyi
                   ` (2 preceding siblings ...)
  2026-09-09  8:02 ` [PATCH 3/5] media: i2c: mt9m114: Add missing v4l2_subdev_cleanup() calls Aleksandr Chubuchnyi
@ 2026-09-09  8:02 ` Aleksandr Chubuchnyi
  2026-09-09  8:02 ` [PATCH 5/5] media: i2c: st-mipid02: " Aleksandr Chubuchnyi
  4 siblings, 0 replies; 6+ messages in thread
From: Aleksandr Chubuchnyi @ 2026-09-09  8:02 UTC (permalink / raw)
  To: sakari.ailus, laurent.pinchart, mchehab, mani, michael.riesch,
	jacopo.mondi, nicholas, benjamin.mugnier, sylvain.petinot
  Cc: linux-media, linux-kernel, stable

The subdev active state allocated by v4l2_subdev_init_finalize() is leaked
on unbind. The driver has no common cleanup helper, so update both sites.

Fixes: e14d3ac81bd2 ("media: i2c: Add driver for OmniVision OV8858")
Cc: stable@vger.kernel.org
Signed-off-by: Aleksandr Chubuchnyi <chubuchnyi@gmail.com>
---
 drivers/media/i2c/ov8858.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/i2c/ov8858.c b/drivers/media/i2c/ov8858.c
index 3f45f7fab..2076620c7 100644
--- a/drivers/media/i2c/ov8858.c
+++ b/drivers/media/i2c/ov8858.c
@@ -1953,6 +1953,7 @@ static int ov8858_probe(struct i2c_client *client)
 	pm_runtime_put_noidle(dev);
 	ov8858_power_off(ov8858);
 err_clean_entity:
+	v4l2_subdev_cleanup(sd);
 	media_entity_cleanup(&sd->entity);
 err_free_handler:
 	v4l2_ctrl_handler_free(&ov8858->ctrl_handler);
@@ -1966,6 +1967,7 @@ static void ov8858_remove(struct i2c_client *client)
 	struct ov8858 *ov8858 = sd_to_ov8858(sd);
 
 	v4l2_async_unregister_subdev(sd);
+	v4l2_subdev_cleanup(sd);
 	media_entity_cleanup(&sd->entity);
 	v4l2_ctrl_handler_free(&ov8858->ctrl_handler);
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 5/5] media: i2c: st-mipid02: Add missing v4l2_subdev_cleanup() call
  2026-09-09  8:02 [PATCH 0/5] media: i2c: Add missing v4l2_subdev_cleanup() calls Aleksandr Chubuchnyi
                   ` (3 preceding siblings ...)
  2026-09-09  8:02 ` [PATCH 4/5] media: i2c: ov8858: Add missing v4l2_subdev_cleanup() call Aleksandr Chubuchnyi
@ 2026-09-09  8:02 ` Aleksandr Chubuchnyi
  4 siblings, 0 replies; 6+ messages in thread
From: Aleksandr Chubuchnyi @ 2026-09-09  8:02 UTC (permalink / raw)
  To: sakari.ailus, laurent.pinchart, mchehab, mani, michael.riesch,
	jacopo.mondi, nicholas, benjamin.mugnier, sylvain.petinot
  Cc: linux-media, linux-kernel, stable

The subdev active state allocated by v4l2_subdev_init_finalize() is leaked
on unbind. The driver has no common cleanup helper, so update both sites.

Fixes: 04d170b288b3 ("media: i2c: st-mipid02: use active state to store pad formats")
Cc: stable@vger.kernel.org
Signed-off-by: Aleksandr Chubuchnyi <chubuchnyi@gmail.com>
---
 drivers/media/i2c/st-mipid02.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c
index 4675181af..b2f275129 100644
--- a/drivers/media/i2c/st-mipid02.c
+++ b/drivers/media/i2c/st-mipid02.c
@@ -919,6 +919,7 @@ static int mipid02_probe(struct i2c_client *client)
 power_off:
 	mipid02_set_power_off(&client->dev);
 entity_cleanup:
+	v4l2_subdev_cleanup(&bridge->sd);
 	media_entity_cleanup(&bridge->sd.entity);
 
 	return ret;
@@ -937,6 +938,7 @@ static void mipid02_remove(struct i2c_client *client)
 	if (!pm_runtime_status_suspended(&client->dev))
 		mipid02_set_power_off(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
+	v4l2_subdev_cleanup(&bridge->sd);
 	media_entity_cleanup(&bridge->sd.entity);
 }
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-09-09  8:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-09  8:02 [PATCH 0/5] media: i2c: Add missing v4l2_subdev_cleanup() calls Aleksandr Chubuchnyi
2026-09-09  8:02 ` [PATCH 1/5] media: i2c: imx296: Add missing v4l2_subdev_cleanup() call Aleksandr Chubuchnyi
2026-09-09  8:02 ` [PATCH 2/5] media: i2c: imx415: " Aleksandr Chubuchnyi
2026-09-09  8:02 ` [PATCH 3/5] media: i2c: mt9m114: Add missing v4l2_subdev_cleanup() calls Aleksandr Chubuchnyi
2026-09-09  8:02 ` [PATCH 4/5] media: i2c: ov8858: Add missing v4l2_subdev_cleanup() call Aleksandr Chubuchnyi
2026-09-09  8:02 ` [PATCH 5/5] media: i2c: st-mipid02: " Aleksandr Chubuchnyi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®