From: Dmitriy Geels <dmitriy.geels@gmail.com>
To: "Filipe Laíns" <lains@riseup.net>, "Bastien Nocera" <hadess@hadess.net>
Cc: Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>,
Stuart Hayhurst <stuart.a.hayhurst@gmail.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Dmitriy Geels <dmitriy.geels@gmail.com>
Subject: [PATCH] HID: logitech-hidpp: cancel reset_hi_res_work on probe failure
Date: Mon, 24 Aug 2026 19:37:18 +0200 [thread overview]
Message-ID: <20260824173718.14687-1-dmitriy.geels@gmail.com> (raw)
The probe error path cancels hidpp->work before freeing the HID++ device
data, but does not cancel reset_hi_res_work.
reset_hi_res_work can be scheduled while probing the device. If probe
subsequently fails, the work can run after the driver data has been
freed.
Cancel reset_hi_res_work in the probe error path to prevent a potential
use-after-free.
Fixes: ed80cc4667ac ("HID: logitech-hidpp: Add HIDPP_QUIRK_RESET_HI_RES_SCROLL")
Signed-off-by: Dmitriy Geels <dmitriy.geels@gmail.com>
---
This patch is a result of Sashiko AI review for "HID: logitech-hidpp:
add native touchpad support for K400 Plus":
- [High] Missing cancel_work_sync for reset_hi_res_work in the probe error path leads to a Use-After-Free.
drivers/hid/hid-logitech-hidpp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 9a6b04283130..279384fa9835 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -4925,6 +4925,7 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)
hid_hw_start_fail:
sysfs_remove_group(&hdev->dev.kobj, &ps_attribute_group);
cancel_work_sync(&hidpp->work);
+ cancel_work_sync(&hidpp->reset_hi_res_work);
mutex_destroy(&hidpp->send_mutex);
return ret;
}
--
2.55.0
reply other threads:[~2026-08-24 17:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260824173718.14687-1-dmitriy.geels@gmail.com \
--to=dmitriy.geels@gmail.com \
--cc=bentiss@kernel.org \
--cc=hadess@hadess.net \
--cc=jikos@kernel.org \
--cc=lains@riseup.net \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stuart.a.hayhurst@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®