• Dmitry Torokhov's avatar
    Input: serio_raw - fix memory leak when closing char device · 550eca7c
    Dmitry Torokhov authored
    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: default avatarWanlong Gao <gaowanlong@cn.fujitsu.com>
    Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
    550eca7c
serio_raw.c 9.98 KB