]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Bluetooth: add NULL pointer check in HCI
authorJun Nie <njun@marvell.com>
Tue, 7 Dec 2010 06:03:38 +0000 (14:03 +0800)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Mon, 10 Feb 2014 21:11:18 +0000 (16:11 -0500)
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: Paul Gortmaker <paul.gortmaker@windriver.com>
drivers/bluetooth/hci_ldisc.c

index 283b127cea743446e060ac582434f66c0a60d603..91be8d53d8195b3615c90325b7abfc813620146e 100644 (file)
@@ -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);
+                       }
                }
        }
 }