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: <20251126105445.1810-1-vulab@iscas.ac.cn>
Date: Wed, 26 Nov 2025 18:54:45 +0800
From: Haotian Zhang <vulab@...as.ac.cn>
To: Guenter Roeck <linux@...ck-us.net>,
	Alistair Francis <alistair@...stair23.me>
Cc: linux-hwmon@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Haotian Zhang <vulab@...as.ac.cn>
Subject: [PATCH] hwmon: sy7636a: Fix regulator_enable resource leak on error path

In sy7636a_sensor_probe(), regulator_enable() is called but if
devm_hwmon_device_register_with_info() fails, the function returns
without calling regulator_disable(), leaving the regulator enabled
and leaking the reference count.

Add regulator_disable() call in the error path to properly disable
the regulator.

Fixes: de34a4053250 ("hwmon: sy7636a: Add temperature driver for sy7636a")
Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
---
 drivers/hwmon/sy7636a-hwmon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwmon/sy7636a-hwmon.c b/drivers/hwmon/sy7636a-hwmon.c
index ed110884786b..b8e598a616ad 100644
--- a/drivers/hwmon/sy7636a-hwmon.c
+++ b/drivers/hwmon/sy7636a-hwmon.c
@@ -88,6 +88,7 @@ static int sy7636a_sensor_probe(struct platform_device *pdev)
 	if (IS_ERR(hwmon_dev)) {
 		err = PTR_ERR(hwmon_dev);
 		dev_err(&pdev->dev, "Unable to register hwmon device, returned %d\n", err);
+		regulator_disable(regulator);
 		return err;
 	}
 
-- 
2.50.1.windows.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ