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: <20250609-must_check-devm_mutex_init-v6-2-9540d5df9704@weissschuh.net>
Date: Mon, 09 Jun 2025 22:38:38 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, 
 Waiman Long <longman@...hat.com>, Boqun Feng <boqun.feng@...il.com>, 
 Vicentiu Galanopulo <vicentiu.galanopulo@...ote-tech.co.uk>, 
 Will Deacon <will@...nel.org>, Han Xu <han.xu@....com>, 
 Haibo Chen <haibo.chen@....com>, Yogesh Gaur <yogeshgaur.83@...il.com>, 
 Mark Brown <broonie@...nel.org>, Lee Jones <lee@...nel.org>, 
 Pavel Machek <pavel@...nel.org>, Andrew Davis <afd@...com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, 
 linux-kernel@...r.kernel.org, Bartosz Golaszewski <brgl@...ev.pl>, 
 Bartosz Golaszewski <bartosz.golaszewski@...aro.org>, 
 linux-spi@...r.kernel.org, imx@...ts.linux.dev, linux-leds@...r.kernel.org, 
 Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH v6 2/3] leds: lp8860: Check return value of
 devm_mutex_init()

Even if it's not critical, the avoidance of checking the error code
from devm_mutex_init() call today diminishes the point of using devm
variant of it. Tomorrow it may even leak something.

Add the missed check.

Fixes: 87a59548af95 ("leds: lp8860: Use new mutex guards to cleanup function exits")
Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
 drivers/leds/leds-lp8860.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c
index 52b97c9f2a03567aa12d4f63a951593a5e7017d5..0962c00c215a11f555a7878a3b65824b5219a1fa 100644
--- a/drivers/leds/leds-lp8860.c
+++ b/drivers/leds/leds-lp8860.c
@@ -307,7 +307,9 @@ static int lp8860_probe(struct i2c_client *client)
 	led->client = client;
 	led->led_dev.brightness_set_blocking = lp8860_brightness_set;
 
-	devm_mutex_init(&client->dev, &led->lock);
+	ret = devm_mutex_init(&client->dev, &led->lock);
+	if (ret)
+		return dev_err_probe(&client->dev, ret, "Failed to initialize lock\n");
 
 	led->regmap = devm_regmap_init_i2c(client, &lp8860_regmap_config);
 	if (IS_ERR(led->regmap)) {

-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ