Commit 420cc350 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by David S. Miller

[Bluetooth] Avoid NULL pointer dereference with tty->driver

This patch checks for tty->driver before trying to call flush_buffer().
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 25ea6db0
...@@ -191,7 +191,7 @@ static int hci_uart_flush(struct hci_dev *hdev) ...@@ -191,7 +191,7 @@ static int hci_uart_flush(struct hci_dev *hdev)
/* Flush any pending characters in the driver and discipline. */ /* Flush any pending characters in the driver and discipline. */
tty_ldisc_flush(tty); tty_ldisc_flush(tty);
if (tty->driver->flush_buffer) if (tty->driver && tty->driver->flush_buffer)
tty->driver->flush_buffer(tty); tty->driver->flush_buffer(tty);
if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) if (test_bit(HCI_UART_PROTO_SET, &hu->flags))
...@@ -290,7 +290,7 @@ static int hci_uart_tty_open(struct tty_struct *tty) ...@@ -290,7 +290,7 @@ static int hci_uart_tty_open(struct tty_struct *tty)
if (tty->ldisc.flush_buffer) if (tty->ldisc.flush_buffer)
tty->ldisc.flush_buffer(tty); tty->ldisc.flush_buffer(tty);
if (tty->driver->flush_buffer) if (tty->driver && tty->driver->flush_buffer)
tty->driver->flush_buffer(tty); tty->driver->flush_buffer(tty);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment