]> err.no Git - linux-2.6/commitdiff
[Bluetooth] Avoid NULL pointer dereference with tty->driver
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 6 Jul 2006 13:53:31 +0000 (15:53 +0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 12 Jul 2006 22:34:30 +0000 (15:34 -0700)
This patch checks for tty->driver before trying to call flush_buffer().

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/hci_ldisc.c

index 1994270c16e1992536380b620ef70afcf33c28bb..93ba25b7ea328303fad462372ddb575e69ea207e 100644 (file)
@@ -191,7 +191,7 @@ static int hci_uart_flush(struct hci_dev *hdev)
 
        /* Flush any pending characters in the driver and discipline. */
        tty_ldisc_flush(tty);
-       if (tty->driver->flush_buffer)
+       if (tty->driver && tty->driver->flush_buffer)
                tty->driver->flush_buffer(tty);
 
        if (test_bit(HCI_UART_PROTO_SET, &hu->flags))
@@ -290,7 +290,7 @@ static int hci_uart_tty_open(struct tty_struct *tty)
        if (tty->ldisc.flush_buffer)
                tty->ldisc.flush_buffer(tty);
 
-       if (tty->driver->flush_buffer)
+       if (tty->driver && tty->driver->flush_buffer)
                tty->driver->flush_buffer(tty);
 
        return 0;