[PATCH] Char: isicom, fix close bug
authorJiri Slaby <jirislaby@gmail.com>
Tue, 14 Nov 2006 23:30:17 +0000 (00:30 +0100)
committerLinus Torvalds <torvalds@woody.osdl.org>
Wed, 15 Nov 2006 00:02:02 +0000 (16:02 -0800)
port is dereferenced even if it is NULL.  Dereference it _after_ the
check if (!port)...  Thanks Eric <ef87@yahoo.com> for reporting this.

This fixes

http://bugzilla.kernel.org/show_bug.cgi?id=7527

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/isicom.c

index e9e9bf31c369ef9b8b96cd3f65ac463647b7af69..58c955e390b3cf652ab6271f1184ca0d286de3dc 100644 (file)
@@ -1062,11 +1062,12 @@ static void isicom_shutdown_port(struct isi_port *port)
 static void isicom_close(struct tty_struct *tty, struct file *filp)
 {
        struct isi_port *port = tty->driver_data;
-       struct isi_board *card = port->card;
+       struct isi_board *card;
        unsigned long flags;
 
        if (!port)
                return;
+       card = port->card;
        if (isicom_paranoia_check(port, tty->name, "isicom_close"))
                return;