Skip to content

Commit

Permalink
[Bluetooth] Fix NULL pointer dereference in HCI line discipline
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
holtmann authored and David S. Miller committed May 11, 2007
1 parent d215874 commit 22ad420
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/bluetooth/hci_ldisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,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);
Expand Down

0 comments on commit 22ad420

Please sign in to comment.