Skip to content

Commit

Permalink
evdev: Release eventual input device grabs when getting disconnected
Browse files Browse the repository at this point in the history
When getting disconnected we need to release eventual grabs on the
underlying input device as we also release the input device itself.
Otherwise, we would try to release the grab when the client that
requested it closes its handle, accessing the input device which
might already be freed.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Björn Steinbrink authored and Linus Torvalds committed Mar 30, 2008
1 parent d6e4218 commit eb08b6b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/input/evdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,9 @@ static void evdev_cleanup(struct evdev *evdev)
evdev_hangup(evdev);
evdev_remove_chrdev(evdev);

if (evdev->grab)
evdev_ungrab(evdev, evdev->grab);

/* evdev is marked dead so no one else accesses evdev->open */
if (evdev->open) {
input_flush_device(handle, NULL);
Expand Down

0 comments on commit eb08b6b

Please sign in to comment.