diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-11-15 09:49:49 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-16 02:18:55 +0100 |
commit | 81c79838ca24f48e0e4bb96502d131d6af758ae0 (patch) | |
tree | 2ca7959df8ebba974bc9ba9011ab25e0550ed63d /drivers/tty/tty_port.c | |
parent | TTY: isicom, stop using port->tty (diff) | |
download | linux-81c79838ca24f48e0e4bb96502d131d6af758ae0.tar.xz linux-81c79838ca24f48e0e4bb96502d131d6af758ae0.zip |
TTY: pty, fix tty buffers leak
After commit "TTY: move tty buffers to tty_port", the tty buffers are
not freed in some drivers. This is because tty_port_destructor is not
called whenever a tty_port is freed. This was an assumption I counted
with but was unfortunately untrue. So fix the drivers to fulfil this
assumption.
PTY is one of those, here we just need to use tty_port_put instead of
kfree. (Assuming tty_port_destructor does not need port->ops to be set
which we change here too.)
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_port.c')
-rw-r--r-- | drivers/tty/tty_port.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 416b42f7c346..fdc42c2d565f 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -128,7 +128,7 @@ static void tty_port_destructor(struct kref *kref) if (port->xmit_buf) free_page((unsigned long)port->xmit_buf); tty_buffer_free_all(port); - if (port->ops->destruct) + if (port->ops && port->ops->destruct) port->ops->destruct(port); else kfree(port); |