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]
Date: Sat, 16 Mar 2024 17:31:36 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Linus Walleij <linus.walleij@...aro.org>,
	Sebastien Bourdelin <sebastien.bourdelin@...oirfairelinux.com>,
	Arnd Bergmann <arnd@...db.de>
Cc: linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org,
	Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH] bus: ts-nbus: Fix an error handling path in ts_nbus_probe()

If of_platform_populate() fails, we must shutdown the FPGA, as already done
in the remove function.

Fixes: 5b143d2a6ede ("bus: add driver for the Technologic Systems NBUS")
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
Compile tested only.

This patch is speculative and based on the output of one of my scripts that
tries to spot calls in .remove function that are not also in the error
handling path of the probe. I'm not familiar with the pwm_ API.

I don't think that the locking in the remove function is needed here.

Review with care.
---
 drivers/bus/ts-nbus.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/ts-nbus.c b/drivers/bus/ts-nbus.c
index baf22a82c47a..fa1bb9b78446 100644
--- a/drivers/bus/ts-nbus.c
+++ b/drivers/bus/ts-nbus.c
@@ -309,13 +309,19 @@ static int ts_nbus_probe(struct platform_device *pdev)
 	dev_set_drvdata(dev, ts_nbus);
 
 	ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
-	if (ret < 0)
-		return dev_err_probe(dev, ret,
-				     "failed to populate platform devices on bus\n");
+	if (ret < 0) {
+		dev_err_probe(dev, ret,
+			      "failed to populate platform devices on bus\n");
+		goto err_disable_pwm;
+	}
 
 	dev_info(dev, "initialized\n");
 
 	return 0;
+
+err_disable_pwm:
+	pwm_disable(ts_nbus->pwm);
+	return ret;
 }
 
 static void ts_nbus_remove(struct platform_device *pdev)
-- 
2.44.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ