From dc6802a771e91050fb686dfeeb9de4c6c9cadb79 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 24 Jul 2012 12:52:04 +0100 Subject: tty: handle NULL parameters in free_tty_struct() We sometimes pass NULL pointers to free_tty_struct(). One example where it can happen is in the error handling code in pty_common_install(). Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/tty/tty_io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 608749978df4..6784aae210e3 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -181,6 +181,8 @@ struct tty_struct *alloc_tty_struct(void) void free_tty_struct(struct tty_struct *tty) { + if (!tty) + return; if (tty->dev) put_device(tty->dev); kfree(tty->write_buf); -- cgit v1.2.3