]> git.karo-electronics.de Git - linux-beck.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)
commit550eca7cafa1c6e2c077afb2211a364a982d8645
tree1dbb10a995aac0fa624ad86c12ae71378e2bb94e
parent8c1c10d5706bbb3b41cb4a5578339d67d3eeffc2
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