]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
HID: hidpp: fix potential UAF in hidpp_connect_event()
authorJiri Kosina <jkosina@suse.com>
Fri, 12 Jun 2026 15:48:22 +0000 (17:48 +0200)
committerJiri Kosina <jkosina@suse.com>
Mon, 15 Jun 2026 12:57:04 +0000 (14:57 +0200)
If input_register_device() fails, we call input_free_device(), but keep
stale pointer to the old device in hidpp->input, which could potentially
lead to UAF. Fix that by resetting it to NULL before returning from
hidpp_connect_event().

Reported-by: zdi-disclosures@trendmicro.com
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/hid-logitech-hidpp.c

index ccbf28869a968ddf8c0c0293a2b54728cd3e4eca..d8e86b6ccf37550690e023dee8446206b022f3bb 100644 (file)
@@ -4295,6 +4295,7 @@ static void hidpp_connect_event(struct work_struct *work)
 
        ret = input_register_device(input);
        if (ret) {
+               hidpp->input = NULL;
                input_free_device(input);
                return;
        }