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: <20231025130737.2015468-2-gnstark@salutedevices.com>
Date:   Wed, 25 Oct 2023 16:07:30 +0300
From:   George Stark <gnstark@...utedevices.com>
To:     <pavel@....cz>, <lee@...nel.org>, <vadimp@...dia.com>,
        <mpe@...erman.id.au>, <npiggin@...il.com>,
        <christophe.leroy@...roup.eu>, <gnstark@...utedevices.com>
CC:     <linux-leds@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linuxppc-dev@...ts.ozlabs.org>, <kernel@...rdevices.ru>
Subject: [PATCH 1/8] leds: powernv: explicitly unregister LEDs at module's shutdown

LEDs are registered using devm_led_classdev_register() and automatically
unregistered after module's remove(). led_classdev_unregister() calls
led_set_brightness() to turn off the LEDs and module's appropriate callback
uses resources those were destroyed already in module's remove().
So explicitly unregister LEDs at module shutdown.

Signed-off-by: George Stark <gnstark@...utedevices.com>
---
 drivers/leds/leds-powernv.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/leds/leds-powernv.c b/drivers/leds/leds-powernv.c
index 743e2cdd0891..7c7f696c8265 100644
--- a/drivers/leds/leds-powernv.c
+++ b/drivers/leds/leds-powernv.c
@@ -302,7 +302,12 @@ static int powernv_led_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, powernv_led_common);
 
+	if (!devres_open_group(&pdev->dev, priv, GFP_KERNEL))
+		return -ENOMEM;
+
 	rc = powernv_led_classdev(pdev, led_node, powernv_led_common);
+	if (rc)
+		devres_remove_group(dev, priv);
 out:
 	of_node_put(led_node);
 	return rc;
@@ -313,6 +318,8 @@ static int powernv_led_remove(struct platform_device *pdev)
 {
 	struct powernv_led_common *powernv_led_common;
 
+	devres_release_group(&pdev->dev, powernv_led_common);
+
 	/* Disable LED operation */
 	powernv_led_common = platform_get_drvdata(pdev);
 	powernv_led_common->led_disabled = true;
-- 
2.38.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ