All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pietro Borrello <borrello@diag.uniroma1.it>
To: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Hanno Zulla <kontakt@hanno.de>, Pavel Machek <pavel@ucw.cz>,
	Lee Jones <lee@kernel.org>,
	Roderick Colenbrander <roderick.colenbrander@sony.com>,
	Sven Eckelmann <sven@narfation.org>
Cc: linux-leds@vger.kernel.org,
	Cristiano Giuffrida <c.giuffrida@vu.nl>,
	"Bos, H.J." <h.j.bos@vu.nl>, Jakob Koschel <jkl820.git@gmail.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jiri Kosina <jkosina@suse.cz>,
	Roderick Colenbrander <roderick@gaikai.com>,
	Pietro Borrello <borrello@diag.uniroma1.it>
Subject: [PATCH v2 2/5] HID: asus_remove: manually unregister led
Date: Tue, 31 Jan 2023 13:08:46 +0000	[thread overview]
Message-ID: <20230125-hid-unregister-leds-v2-2-689cc62fc878@diag.uniroma1.it> (raw)
In-Reply-To: <20230125-hid-unregister-leds-v2-0-689cc62fc878@diag.uniroma1.it>

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@diag.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

  parent reply	other threads:[~2023-01-31 13:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31 13:08 [PATCH v2 0/5] HID: manually unregister leds on device removal to prevent UAFs Pietro Borrello
2023-01-31 13:08 ` [PATCH v2 1/5] HID: bigben_remove: manually unregister leds Pietro Borrello
2023-02-09  8:55   ` Benjamin Tissoires
2023-02-09 12:45     ` Pietro Borrello
2023-01-31 13:08 ` Pietro Borrello [this message]
2023-01-31 13:08 ` [PATCH v2 3/5] HID: dualsense_remove: " Pietro Borrello
2023-02-09  8:59   ` Benjamin Tissoires
2023-02-09 12:50     ` Pietro Borrello
2023-01-31 13:08 ` [PATCH v2 4/5] HID: dualshock4_remove: " Pietro Borrello
2023-01-31 13:08 ` [PATCH v2 5/5] HID: sony_remove: " Pietro Borrello
2023-01-31 17:19 ` [PATCH v2 0/5] HID: manually unregister leds on device removal to prevent UAFs Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230125-hid-unregister-leds-v2-2-689cc62fc878@diag.uniroma1.it \
    --to=borrello@diag.uniroma1.it \
    --cc=benjamin.tissoires@redhat.com \
    --cc=c.giuffrida@vu.nl \
    --cc=h.j.bos@vu.nl \
    --cc=jikos@kernel.org \
    --cc=jkl820.git@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=kontakt@hanno.de \
    --cc=lee@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=roderick.colenbrander@sony.com \
    --cc=roderick@gaikai.com \
    --cc=sven@narfation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.