diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-07-24 07:52:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-10 15:54:27 -0400 |
commit | dc6802a771e91050fb686dfeeb9de4c6c9cadb79 (patch) | |
tree | 1fa2d7ffa108e53a2433e816a8195aec7d6050f0 /drivers/tty/tty_io.c | |
parent | 4ac5d7050e4e4d63751e78fb152a274d05c08563 (diff) |
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 <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_io.c')
-rw-r--r-- | drivers/tty/tty_io.c | 2 |
1 files changed, 2 insertions, 0 deletions
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) | |||
181 | 181 | ||
182 | void free_tty_struct(struct tty_struct *tty) | 182 | void free_tty_struct(struct tty_struct *tty) |
183 | { | 183 | { |
184 | if (!tty) | ||
185 | return; | ||
184 | if (tty->dev) | 186 | if (tty->dev) |
185 | put_device(tty->dev); | 187 | put_device(tty->dev); |
186 | kfree(tty->write_buf); | 188 | kfree(tty->write_buf); |