소스 검색

[Bluetooth] Fix wrong URB handling of btusb driver

The btusb driver contains two typos that result in some buggy behavior,
but the impact is not immediately visible.

During initialization the submitting of interrupt URBs might fail and
then make sure to remove the correct flag and not one of the hci_dev
flags.

When closing down the interface make sure to kill the anchor for the
ISOC URBs and not kill the interrupt URBs twice.

Also cancel any scheduled work when closing down the interface.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Marcel Holtmann 17 년 전
부모
커밋
e8c3c3d22b
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      drivers/bluetooth/btusb.c

+ 4 - 2
drivers/bluetooth/btusb.c

@@ -519,7 +519,7 @@ static int btusb_open(struct hci_dev *hdev)
 
 
 	err = btusb_submit_intr_urb(hdev);
 	err = btusb_submit_intr_urb(hdev);
 	if (err < 0) {
 	if (err < 0) {
-		clear_bit(BTUSB_INTR_RUNNING, &hdev->flags);
+		clear_bit(BTUSB_INTR_RUNNING, &data->flags);
 		clear_bit(HCI_RUNNING, &hdev->flags);
 		clear_bit(HCI_RUNNING, &hdev->flags);
 	}
 	}
 
 
@@ -535,8 +535,10 @@ static int btusb_close(struct hci_dev *hdev)
 	if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
 	if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
 		return 0;
 		return 0;
 
 
+	cancel_work_sync(&data->work);
+
 	clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
 	clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
-	usb_kill_anchored_urbs(&data->intr_anchor);
+	usb_kill_anchored_urbs(&data->isoc_anchor);
 
 
 	clear_bit(BTUSB_BULK_RUNNING, &data->flags);
 	clear_bit(BTUSB_BULK_RUNNING, &data->flags);
 	usb_kill_anchored_urbs(&data->bulk_anchor);
 	usb_kill_anchored_urbs(&data->bulk_anchor);