summaryrefslogtreecommitdiff
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorJun Nie <njun@marvell.com>2010-12-07 14:03:38 +0800
committerWilly Tarreau <w@1wt.eu>2012-10-07 23:37:38 +0200
commitc74bc8b772076fc6b0b54a82ab3d100142ea9a99 (patch)
tree8df5cb49cbfe943790203c1fcf78d2896d631d6c /drivers/bluetooth
parentab81b6abd9a1cdac0d6e84515cc808f735fc78b7 (diff)
Bluetooth: add NULL pointer check in HCI
commit d9319560b86839506c2011346b1f2e61438a3c73 upstream. If we fail to find a hci device pointer in hci_uart, don't try to deref the NULL one we do have. Signed-off-by: Jun Nie <njun@marvell.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi> Signed-off-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/hci_ldisc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index e3d4eda93ed9..e6f67b62876b 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -313,8 +313,10 @@ static void hci_uart_tty_close(struct tty_struct *tty)
if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) {
hu->proto->close(hu);
- hci_unregister_dev(hdev);
- hci_free_dev(hdev);
+ if (hdev) {
+ hci_unregister_dev(hdev);
+ hci_free_dev(hdev);
+ }
}
}
}