lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250923151605.17689-1-johan@kernel.org>
Date: Tue, 23 Sep 2025 17:16:05 +0200
From: Johan Hovold <johan@...nel.org>
To: Patrice Chotard <patrice.chotard@...s.st.com>,
	Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Johan Hovold <johan@...nel.org>,
	stable@...r.kernel.org,
	Peter Griffin <peter.griffin@...aro.org>
Subject: [PATCH] media: c8sectpfe: fix probe device leaks

Make sure to drop the references taken to the I2C adapters during probe
on probe failure (e.g. probe deferral) and on driver unbind.

Fixes: c5f5d0f99794 ("[media] c8sectpfe: STiH407/10 Linux DVB demux support")
Cc: stable@...r.kernel.org	# 4.3
Cc: Peter Griffin <peter.griffin@...aro.org>
Signed-off-by: Johan Hovold <johan@...nel.org>
---
 .../media/platform/st/sti/c8sectpfe/c8sectpfe-core.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
index 89bd15a4d26a..3f94d9b4ef1e 100644
--- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
+++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
@@ -655,6 +655,13 @@ static irqreturn_t c8sectpfe_error_irq_handler(int irq, void *priv)
 	return IRQ_HANDLED;
 }
 
+static void c8sectpfe_put_device(void *_dev)
+{
+	struct device *dev = _dev;
+
+	put_device(dev);
+}
+
 static int c8sectpfe_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -799,6 +806,11 @@ static int c8sectpfe_probe(struct platform_device *pdev)
 			return -ENODEV;
 		}
 
+		ret = devm_add_action_or_reset(dev, c8sectpfe_put_device,
+					       &tsin->i2c_adapter->dev);
+		if (ret)
+			return ret;
+
 		/* Acquire reset GPIO and activate it */
 		tsin->rst_gpio = devm_fwnode_gpiod_get(dev,
 						       of_fwnode_handle(child),
-- 
2.49.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ