aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/evdev.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2008-04-01 00:22:53 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-04-01 00:22:53 -0400
commita7097ff89c3204737a07eecbc83f9ae6002cc534 (patch)
tree11fe55cbfb3651fc57e59fc838d1e084f5e63749 /drivers/input/evdev.c
parent399f486286f44d55c4fff0e9cc5d712f2b443489 (diff)
Input: make sure input interfaces pin parent input devices
Recent driver core change causes references to parent devices being dropped early, at device_del() time, as opposed to when all children are freed. This causes oops in evdev with grabbed devices. Take the reference to the parent input device ourselves to ensure that it stays around long enough. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/evdev.c')
-rw-r--r--drivers/input/evdev.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 99562cee827e..b32984bc516f 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -124,6 +124,7 @@ static void evdev_free(struct device *dev)
124{ 124{
125 struct evdev *evdev = container_of(dev, struct evdev, dev); 125 struct evdev *evdev = container_of(dev, struct evdev, dev);
126 126
127 input_put_device(evdev->handle.dev);
127 kfree(evdev); 128 kfree(evdev);
128} 129}
129 130
@@ -853,9 +854,6 @@ static void evdev_cleanup(struct evdev *evdev)
853 evdev_hangup(evdev); 854 evdev_hangup(evdev);
854 evdev_remove_chrdev(evdev); 855 evdev_remove_chrdev(evdev);
855 856
856 if (evdev->grab)
857 evdev_ungrab(evdev, evdev->grab);
858
859 /* evdev is marked dead so no one else accesses evdev->open */ 857 /* evdev is marked dead so no one else accesses evdev->open */
860 if (evdev->open) { 858 if (evdev->open) {
861 input_flush_device(handle, NULL); 859 input_flush_device(handle, NULL);
@@ -896,7 +894,7 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
896 evdev->exist = 1; 894 evdev->exist = 1;
897 evdev->minor = minor; 895 evdev->minor = minor;
898 896
899 evdev->handle.dev = dev; 897 evdev->handle.dev = input_get_device(dev);
900 evdev->handle.name = evdev->name; 898 evdev->handle.name = evdev->name;
901 evdev->handle.handler = handler; 899 evdev->handle.handler = handler;
902 evdev->handle.private = evdev; 900 evdev->handle.private = evdev;