Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dan Carpenter and committed by
Greg Kroah-Hartman
dc6802a7 4ac5d705

+2
+2
drivers/tty/tty_io.c
··· 181 181 182 182 void free_tty_struct(struct tty_struct *tty) 183 183 { 184 + if (!tty) 185 + return; 184 186 if (tty->dev) 185 187 put_device(tty->dev); 186 188 kfree(tty->write_buf);