Skip to content

Commit

Permalink
[Bluetooth] Avoid NULL pointer dereference with tty->driver
Browse files Browse the repository at this point in the history
This patch checks for tty->driver before trying to call flush_buffer().

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Marcel Holtmann authored and David S. Miller committed Jul 12, 2006
1 parent 25ea6db commit 420cc35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/bluetooth/hci_ldisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 420cc35

Please sign in to comment.