aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-07-06 09:53:31 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-07-12 18:34:30 -0400
commit420cc3505f91246699bcfb88d30c4466adc0b87b (patch)
treee4732e344576a094766df06640d9ec3aa80a98ab
parent25ea6db04a96d7871e7ece27d566f3228d59d932 (diff)
[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 <marcel@holtmann.org>
-rw-r--r--drivers/bluetooth/hci_ldisc.c4
1 files changed, 2 insertions, 2 deletions
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)
191 191
192 /* Flush any pending characters in the driver and discipline. */ 192 /* Flush any pending characters in the driver and discipline. */
193 tty_ldisc_flush(tty); 193 tty_ldisc_flush(tty);
194 if (tty->driver->flush_buffer) 194 if (tty->driver && tty->driver->flush_buffer)
195 tty->driver->flush_buffer(tty); 195 tty->driver->flush_buffer(tty);
196 196
197 if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) 197 if (test_bit(HCI_UART_PROTO_SET, &hu->flags))
@@ -290,7 +290,7 @@ static int hci_uart_tty_open(struct tty_struct *tty)
290 if (tty->ldisc.flush_buffer) 290 if (tty->ldisc.flush_buffer)
291 tty->ldisc.flush_buffer(tty); 291 tty->ldisc.flush_buffer(tty);
292 292
293 if (tty->driver->flush_buffer) 293 if (tty->driver && tty->driver->flush_buffer)
294 tty->driver->flush_buffer(tty); 294 tty->driver->flush_buffer(tty);
295 295
296 return 0; 296 return 0;