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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250920114311.291450-2-andreas@kemnade.info>
Date: Sat, 20 Sep 2025 13:43:10 +0200
From: Andreas Kemnade <andreas@...nade.info>
To: jdelvare@...e.com,
	linux@...ck-us.net,
	lgirdwood@...il.com,
	broonie@...nel.org,
	linux-hwmon@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Alistair Francis <alistair@...stair23.me>
Cc: Andreas Kemnade <andreas@...nade.info>
Subject: [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices

If regulator subdevice is not ready early enough, devm_regulator_get will
get a dummy regulator device, not the real one needed from the regulator
subdevice, so defer probe in such case.
devm_regulator_get_optional returns an error in that case.

That fixes things, but looks odd, therefore RFC.

Signed-off-by: Andreas Kemnade <andreas@...nade.info>
---
 drivers/hwmon/sy7636a-hwmon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/sy7636a-hwmon.c b/drivers/hwmon/sy7636a-hwmon.c
index ed110884786b..e83d0e50c735 100644
--- a/drivers/hwmon/sy7636a-hwmon.c
+++ b/drivers/hwmon/sy7636a-hwmon.c
@@ -73,9 +73,9 @@ static int sy7636a_sensor_probe(struct platform_device *pdev)
 	if (!regmap)
 		return -EPROBE_DEFER;
 
-	regulator = devm_regulator_get(&pdev->dev, "vcom");
-	if (IS_ERR(regulator))
-		return PTR_ERR(regulator);
+	regulator = devm_regulator_get_optional(&pdev->dev, "vcom");
+	if (IS_ERR_OR_NULL(regulator))
+		return -EPROBE_DEFER;
 
 	err = regulator_enable(regulator);
 	if (err)
-- 
2.47.3


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ