Browse Source

Bluetooth: Fix HCIUARTGETDEVICE ioctl when UART is not registered

The protocol for the UART might be configured, but that does not
mean the HCI device is registered. Return an error in that case
and only return the index number when HCI_UART_REGISTERED is set.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Marcel Holtmann 11 years ago
parent
commit
c7e0c14115
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/bluetooth/hci_ldisc.c

+ 1 - 1
drivers/bluetooth/hci_ldisc.c

@@ -539,7 +539,7 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, struct file * file,
 		return -EUNATCH;
 		return -EUNATCH;
 
 
 	case HCIUARTGETDEVICE:
 	case HCIUARTGETDEVICE:
-		if (test_bit(HCI_UART_PROTO_SET, &hu->flags))
+		if (test_bit(HCI_UART_REGISTERED, &hu->flags))
 			return hu->hdev->id;
 			return hu->hdev->id;
 		return -EUNATCH;
 		return -EUNATCH;