public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] evdev: Release eventual input device grabs when getting disconnected
@ 2008-03-30 18:42 Björn Steinbrink
  2008-03-30 21:51 ` Linus Torvalds
                   ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: Björn Steinbrink @ 2008-03-30 18:42 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Linus Torvalds, Arjan van de Ven, Linux Kernel Mailing List,
	Johannes Berg, Jiri Kosina

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>
---
I can't reproduce the bug on my UP box and currently can't afford
crashing my SMP box (all the oopses seem to come from SMP kernels, so I
guess it needs SMP to crash), so while this doesn't show any new
problems, I can't tell whether it actually fixes anything. Testers
welcome!

 drivers/input/evdev.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 0727b0a..99562ce 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -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);
-- 
1.5.5.rc2

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

end of thread, other threads:[~2008-04-02  9:17 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-30 18:42 [PATCH] evdev: Release eventual input device grabs when getting disconnected Björn Steinbrink
2008-03-30 21:51 ` Linus Torvalds
2008-03-30 22:22   ` Greg KH
2008-03-30 22:35     ` Linus Torvalds
2008-03-30 22:42     ` Björn Steinbrink
2008-03-30 23:19       ` Arjan van de Ven
2008-03-31 20:46       ` Dmitry Torokhov
2008-03-31  6:15   ` Dmitry Torokhov
2008-03-31 17:28     ` Greg KH
2008-03-31 18:01       ` Dmitry Torokhov
2008-03-31 18:24         ` Linus Torvalds
2008-03-31 23:12           ` Benjamin Herrenschmidt
2008-03-31 23:51             ` Greg KH
2008-04-01  1:01               ` Benjamin Herrenschmidt
2008-03-31 20:42         ` Greg KH
2008-03-31 20:57           ` Dmitry Torokhov
2008-03-31 22:09             ` Greg KH
2008-04-01  3:30               ` Dmitry Torokhov
2008-03-31 21:27           ` Jiri Kosina
2008-03-31 22:46             ` Kay Sievers
2008-03-31 20:21   ` Johannes Berg
2008-03-31 19:05 ` Björn Steinbrink
2008-04-01 11:51   ` Johannes Berg
2008-04-01 15:20     ` Björn Steinbrink
2008-04-02  9:17       ` Johannes Berg
2008-03-31 21:02 ` Johannes Berg

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