Skip to content

Commit

Permalink
Bluetooth: add NULL pointer check in HCI
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jun Nie authored and Gustavo F. Padovan committed Dec 8, 2010
1 parent 183f732 commit d931956
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/bluetooth/hci_ldisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit d931956

Please sign in to comment.