diff options
author | Alan Cox <alan@linux.intel.com> | 2009-06-29 15:21:47 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-29 09:33:26 -0700 |
commit | aef29bc2603014cb28dfe39bab8d888546fe18e7 (patch) | |
tree | 2fd190b9fb78504adbb7e1fdf902ad9f682633bc /security/commoncap.c | |
parent | 52989765629e7d182b4f146050ebba0abf2cb0b7 (diff) |
tty: Fix the leak in tty_ldisc_release
Currently we reinit the ldisc on final tty close which is what the old code
did to ensure that if the device retained its termios settings then it had the
right ldisc. tty_ldisc_reinit does that but also leaves us with the reset
ldisc reference which is then leaked.
At this point we know the port will be recycled so we can kill the ldisc
off completely rather than try and add another ldisc free up when the kref
count hits zero.
At this point it is safe to keep the ldisc closed as tty_ldisc waiting
methods are only used from the user side, and as the final close we are
the last such reference. Interrupt/driver side methods will always use the
non wait version and get back a NULL.
Found with kmemleak and investigated/identified by Catalin Marinas.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security/commoncap.c')
0 files changed, 0 insertions, 0 deletions