]> git.baikalelectronics.ru Git - kernel.git/commit
Input: serio_raw - fix memory leak when closing char device
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 11 Oct 2011 01:31:39 +0000 (18:31 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 11 Oct 2011 01:35:23 +0000 (18:35 -0700)
commit7135fbbd2db6d23774336eb94ce143e88a7b95e4
tree1dbb10a995aac0fa624ad86c12ae71378e2bb94e
parent49a39566d916bdd1fb1bd6ae17ff264863ed46f2
Input: serio_raw - fix memory leak when closing char device

Apparently we never freed memory allocated when users open our char
devices nor removed old users from the list of connected clients.

Also unregister misc device immediately upon disconnecting the port
instead of waiting until last user drops off (refcounting in misc
device code will make sure needed pieces stay around while they
are needed) and make sure we are not holing holding serio_raw_mutex
when registering/unregistering misc device. This should fix potential
deadlock between serio_raw and misc device code uncovered by lockdep
and reported by Thomas Tuttle.

Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/serio/serio_raw.c