evdev: Release eventual input device grabs when getting disconnected
authorBjörn Steinbrink <B.Steinbrink@gmx.de>
Sun, 30 Mar 2008 18:42:59 +0000 (20:42 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 30 Mar 2008 21:47:49 +0000 (14:47 -0700)
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>
drivers/input/evdev.c

index 0727b0a12557cad63cdf308ac2d7a172a83959ae..99562cee827e7c6af548ec2f889b3fc769dd9213 100644 (file)
@@ -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);