| From f343279adca170481169d9e183a691a7eb6bf2a5 Mon Sep 17 00:00:00 2001 |
| From: Jun Nie <njun@marvell.com> |
| Date: Tue, 7 Dec 2010 14:03:38 +0800 |
| Subject: [PATCH] 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: Paul Gortmaker <paul.gortmaker@windriver.com> |
| --- |
| drivers/bluetooth/hci_ldisc.c | 6 ++++-- |
| 1 file changed, 4 insertions(+), 2 deletions(-) |
| |
| diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c |
| index 283b127cea74..91be8d53d819 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); |
| + } |
| } |
| } |
| } |
| -- |
| 1.8.5.2 |
| |