From: Linas Vepstas Date: Sat, 5 Aug 2006 19:14:36 +0000 (-0700) Subject: [PATCH] pSeries hvsi char driver null pointer deref X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=229395c90aadbadef76bacf52b9cb3326f509e93;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git [PATCH] pSeries hvsi char driver null pointer deref Under certain rare circumstances, it appears that there can be be a NULL-pointer deref when a user fiddles with terminal emeulation programs while outpu is being sent to the console. This patch checks for and avoids a NULL-pointer deref. Signed-off-by: Hollis Blanchard Signed-off-by: Linas Vepstas Cc: Paul Fulghum Acked-by: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c index 41db8060e8f7..54cbb58b8740 100644 --- a/drivers/char/hvsi.c +++ b/drivers/char/hvsi.c @@ -311,7 +311,8 @@ static void hvsi_recv_control(struct hvsi_struct *hp, uint8_t *packet, /* CD went away; no more connection */ pr_debug("hvsi%i: CD dropped\n", hp->index); hp->mctrl &= TIOCM_CD; - if (!(hp->tty->flags & CLOCAL)) + /* If userland hasn't done an open(2) yet, hp->tty is NULL. */ + if (hp->tty && !(hp->tty->flags & CLOCAL)) *to_hangup = hp->tty; } break;