Skip to content

Commit

Permalink
tty: handle NULL parameters in free_tty_struct()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Aug 10, 2012
1 parent 4ac5d70 commit dc6802a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/tty/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit dc6802a

Please sign in to comment.