]> git.baikalelectronics.ru Git - kernel.git/commit
Input: fix use-after-free introduced with dynamic minor changes
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 22 Oct 2012 00:57:20 +0000 (17:57 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 22 Oct 2012 05:50:37 +0000 (08:50 +0300)
commit67194912f866116bb563be4c3175347aad18c038
tree3cf126e431235d21fdf565e2d39089397680e803
parent02e80add0e9dff20d9e05abf8cd35ec6ce4e6ee1
Input: fix use-after-free introduced with dynamic minor changes

Commit 9c30303fae2f ("Input: extend the number of event (and other)
devices") made evdev, joydev and mousedev to embed struct cdev into
their respective structures representing input devices.

Unfortunately character device structure may outlive the parent
structure unless we do not set it up as parent of character device so
that it will stay pinned until character device is freed.

Also, now that parent structure is pinned while character device exists
we do not need to pin and unpin it every time user opens or closes it.

Reported-by: Dave Jones <davej@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/input/evdev.c
drivers/input/joydev.c
drivers/input/mousedev.c