public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] tty: handle NULL parameters in free_tty_struct()
@ 2012-07-20  7:06 Dan Carpenter
  2012-07-20  9:48 ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2012-07-20  7:06 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, kernel-janitors

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>

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index ca7c25d..e49b839 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);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-07-20 21:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-20  7:06 [patch] tty: handle NULL parameters in free_tty_struct() Dan Carpenter
2012-07-20  9:48 ` Alan Cox
2012-07-20 21:32   ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox