linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch for oops in a grabbed evdev after disconnect
@ 2008-03-18  6:48 Pete Zaitcev
  2008-03-18 13:31 ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: Pete Zaitcev @ 2008-03-18  6:48 UTC (permalink / raw)
  To: linux-input; +Cc: zaitcev

If a device was grabbed through evdev and then became disconnected,
we oops on close. This happens because input_release_device uses memory
which was freed.

Fedora enabled evdev in X11 by default recently, and now anyone who
flips a KVM oopses when they log out (Fedora bug 436659).

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 0727b0a..c0874a3 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -155,7 +155,8 @@ static int evdev_ungrab(struct evdev *evdev, struct evdev_client *client)
 
 	rcu_assign_pointer(evdev->grab, NULL);
 	synchronize_rcu();
-	input_release_device(&evdev->handle);
+	if (evdev->exist)
+		input_release_device(&evdev->handle);
 
 	return 0;
 }

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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-18  6:48 Patch for oops in a grabbed evdev after disconnect Pete Zaitcev
2008-03-18 13:31 ` Dmitry Torokhov
2008-03-18 18:03   ` Pete Zaitcev
2008-03-18 18:54     ` Dmitry Torokhov
2008-03-21 17:51       ` Pete Zaitcev
2008-04-08 17:41       ` Pete Zaitcev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).