diff options
author | Chan-yeol Park <chanyeol.park@samsung.com> | 2013-04-02 08:24:22 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-04-04 05:36:00 -0400 |
commit | 788f0923d3cb5256b12113c041c2381e4b3cecf6 (patch) | |
tree | e351468b54d7b70a8c6542c60aefa5f3e1ac6388 /drivers/bluetooth/hci_ldisc.c | |
parent | c2578202919ace314908306346b99796d46aab64 (diff) |
Bluetooth: Fix possible NULL dereference in hci_uart_tty_receive
This patch adds a NULL check for the HCI UART ldisc driver because some
of HCI UART drivers allow hci_uart_tty_receive function to be called
even though the HCI device hasn't been registered yet.
Signed-off-by: Chan-yeol Park <chanyeol.park@samsung.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'drivers/bluetooth/hci_ldisc.c')
-rw-r--r-- | drivers/bluetooth/hci_ldisc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index ed0fade46aed..d710d8b15012 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -388,7 +388,10 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, char *f | |||
388 | 388 | ||
389 | spin_lock(&hu->rx_lock); | 389 | spin_lock(&hu->rx_lock); |
390 | hu->proto->recv(hu, (void *) data, count); | 390 | hu->proto->recv(hu, (void *) data, count); |
391 | hu->hdev->stat.byte_rx += count; | 391 | |
392 | if (hu->hdev) | ||
393 | hu->hdev->stat.byte_rx += count; | ||
394 | |||
392 | spin_unlock(&hu->rx_lock); | 395 | spin_unlock(&hu->rx_lock); |
393 | 396 | ||
394 | tty_unthrottle(tty); | 397 | tty_unthrottle(tty); |