From: Marcel Holtmann Date: Thu, 6 Jul 2006 13:53:31 +0000 (+0200) Subject: [Bluetooth] Avoid NULL pointer dereference with tty->driver X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=420cc3505f91246699bcfb88d30c4466adc0b87b;p=linux-beck.git [Bluetooth] Avoid NULL pointer dereference with tty->driver This patch checks for tty->driver before trying to call flush_buffer(). Signed-off-by: Marcel Holtmann --- diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 1994270c16e1..93ba25b7ea32 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -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;