]> git.ipfire.org Git - thirdparty/linux.git/commit
Input: stop force-feedback timer when unregistering input devices
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 6 Jun 2026 22:04:20 +0000 (15:04 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 23 Jun 2026 05:33:01 +0000 (22:33 -0700)
commitef166ce08801c5237662868d9ec0331d53a38ece
tree1fbb7208d907958c529f9de2eeadc7e52cbec03f
parent0e9943d2e4c63496b6ca84bc66fd3c71d40558e2
Input: stop force-feedback timer when unregistering input devices

Memoryless force-feedback devices use a timer to manage playback of
effects. When a driver for such a device is unbound (or the device is
unregistered for other reasons), the driver typically frees its private
data synchronously. However, the input_dev structure (and its associated
force-feedback structures, including the timer) is only freed when the
last user closes the corresponding device node.

If userspace keeps the device node open while the device is unregistered
(e.g., during driver unbind), the force-feedback timer can still fire
after the driver's private data has been freed.

Introduce a new 'stop' callback to struct ff_device, and call it from
input_unregister_device() before the device is deleted. Implement this
callback for memoryless devices and synchronously shut down the timer to
ensure it is stopped and cannot be rearmed once unregistration happens.

Assisted-by: Gemini:gemini-3.1-pro
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/ff-memless.c
drivers/input/input.c
include/linux/input.h