tty: handle NULL parameters in free_tty_struct()
Subsystems (2)
PATCH 1/1 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().
drivers/tty/tty_io.c +2 -0
@@ -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);
Quoted 4 lines · On Fri, 20 Jul 2012 10:06:34 +0300 Dan Carpenter <[email protected]>…
We sometimes pass NULL pointers to
free_tty_struct(). One example where it can happen is in the error handling code inpty_common_install().Signed-off-by Dan Carpenter <[email protected]>
We probably shouldn't be passing NULLs there but making free_tty_struct(NULL) a no-op matches the kfree and other behaviours and is robust.
Quoted 6 lines · Alan Cox
Quoted 3 lines · On Fri, 20 Jul 2012 10:06:34 +0300 Dan Carpenter <[email protected]>…
We sometimes pass NULL pointers to
free_tty_struct(). One example where it can happen is in the error handling code inpty_common_install().
Quoted 7 lines
Quoted 1 line
Signed-off-by Dan Carpenter <[email protected]>Acked-by Alan Cox <[email protected]>We probably shouldn't be passing NULLs there but making
free_tty_struct(NULL)a no-op matches the kfree and other behaviours and is robust.
Yes, this was unintended. Good catch, Dan.
thanks,
Signature · 2 lines
js suse labs