]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[Bluetooth] Fix NULL pointer dereference in HCI line discipline
authorOhad Ben-Cohen <ohad@bencohen.org>
Fri, 2 Nov 2007 03:41:26 +0000 (04:41 +0100)
committerAdrian Bunk <bunk@kernel.org>
Fri, 2 Nov 2007 03:41:26 +0000 (04:41 +0100)
Normally a serial Bluetooth device is opened, TIOSETD'ed to N_HCI line
discipline, HCIUARTSETPROTO'ed and finally closed. In case the device
fails to HCIUARTSETPROTO, closing it produces a NULL pointer dereference.

Signed-off-by: Ohad Ben-Cohen <ohad@bencohen.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
drivers/bluetooth/hci_ldisc.c

index 4c0e6d85673dd1afc324b3211ee9e9363090dfe7..9e42cc49dce0c35705d319c9b3d4dc817332d94a 100644 (file)
@@ -313,7 +313,9 @@ static void hci_uart_tty_close(struct tty_struct *tty)
 
        if (hu) {
                struct hci_dev *hdev = hu->hdev;
-               hci_uart_close(hdev);
+
+               if (hdev)
+                       hci_uart_close(hdev);
 
                if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) {
                        hu->proto->close(hu);