summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJun Nie <njun@marvell.com>2010-12-07 07:03:38 +0100
committerGustavo F. Padovan <padovan@profusion.mobi>2010-12-08 16:22:22 +0100
commitd9319560b86839506c2011346b1f2e61438a3c73 (patch)
tree891fbc0e6604f575d5135ade3fd827b51038a8e0 /drivers
parentBluetooth: Fix initial RFCOMM DLC security level (diff)
downloadlinux-d9319560b86839506c2011346b1f2e61438a3c73.tar.xz
linux-d9319560b86839506c2011346b1f2e61438a3c73.zip
Bluetooth: add NULL pointer check in HCI
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>
Diffstat (limited to 'drivers')
-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 720148294e64..3c6cabcb7d84 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -311,8 +311,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);
+ }
}
}
}