Linux Input/HID development
 help / color / mirror / Atom feed
* [bug report] Potential order bug in 'drivers/input/misc', particularly 'ati_remote2.c', 'cm109.c', 'keyspan_remote.c'
@ 2026-04-28  4:18 Ginger
  2026-04-28 15:01 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Ginger @ 2026-04-28  4:18 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input

Dear Linux kernel maintainers,

My research-based static analyzer found a potential order bug within
the ' drivers/input/misc' subsystem. I will use the potential bug
found in 'drivers/input/misc/ati_remote2.c' as the typical example.
The similar potential bug patterns are also observed in 'cm109.c' and
'keyspan_remote.c'.

Kernel version: long-term kernel v6.18.9

Potential issue:
T0:
ati_remote2_disconnect
    --> ar2 = usb_get_intfdata(interface);
    --> usb_set_intfdata(interface, NULL);
    --> input_unregister_device(ar2->idev);
    --> usb_driver_release_interface(&ati_remote2_driver, ar2->intf[1]);
    --> kfree(ar2)

T1:
ati_remote2_store_channel_mask (registered as the device attribute
function and exposed via the sysfs)
    --> struct ati_remote2 *ar2 = usb_get_intfdata(intf);
    --> ar2->mode_mask = mask;

In T0, the interface is nullified before its get deregistered. Thus,
it is possible for T1 to still get the usb dev and access it via the
interface, which, however, has been already nullified or even freed.
This similar pattern is also observed in 'cm109_usb_disconnect()' of
file 'cm109.c' and 'keyspan_disconnect()' of file 'keyspan_remote.c'.

Thank you for your time and consideration.

Sincerely,
Ginger

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-28 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-28  4:18 [bug report] Potential order bug in 'drivers/input/misc', particularly 'ati_remote2.c', 'cm109.c', 'keyspan_remote.c' Ginger
2026-04-28 15:01 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox