[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230125-hid-unregister-leds-v1-2-9a5192dcef16@diag.uniroma1.it>
Date: Thu, 26 Jan 2023 00:24:54 +0000
From: Pietro Borrello <borrello@...g.uniroma1.it>
To: Jiri Kosina <jikos@...nel.org>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Hanno Zulla <kontakt@...no.de>,
Carlo Caione <carlo@...lessm.com>, Pavel Machek <pavel@....cz>,
Lee Jones <lee@...nel.org>,
Roderick Colenbrander <roderick.colenbrander@...y.com>,
Sven Eckelmann <sven@...fation.org>
Cc: linux-leds@...r.kernel.org,
Cristiano Giuffrida <c.giuffrida@...nl>,
"Bos, H.J." <h.j.bos@...nl>, Jakob Koschel <jkl820.git@...il.com>,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiri Kosina <jkosina@...e.cz>,
Roderick Colenbrander <roderick@...kai.com>,
Pietro Borrello <borrello@...g.uniroma1.it>
Subject: [PATCH 2/5] HID: asus_remove: manually unregister led
Unregister the LED controller before device removal, as
asus_kbd_backlight_set() may schedule led->work after the structure
has been freed, causing a use-after-free.
Fixes: af22a610bc38 ("HID: asus: support backlight on USB keyboards")
Signed-off-by: Pietro Borrello <borrello@...g.uniroma1.it>
---
drivers/hid/hid-asus.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index f99752b998f3..0f274c8d1bef 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -1122,6 +1122,7 @@ static void asus_remove(struct hid_device *hdev)
if (drvdata->kbd_backlight) {
drvdata->kbd_backlight->removed = true;
+ devm_led_classdev_unregister(&hdev->dev, &drvdata->kbd_backlight->cdev);
cancel_work_sync(&drvdata->kbd_backlight->work);
}
--
2.25.1
Powered by blists - more mailing lists