Commit 3d01580d authored by Douglas Anderson's avatar Douglas Anderson Committed by Hubert Mazur
Browse files

FROMGIT: Bluetooth: btusb: mediatek: Add locks for usb_driver_claim_interface()



The documentation for usb_driver_claim_interface() says that "the
device lock" is needed when the function is called from places other
than probe(). This appears to be the lock for the USB interface
device. The Mediatek btusb code gets called via this path:

  Workqueue: hci0 hci_power_on [bluetooth]
  Call trace:
   usb_driver_claim_interface
   btusb_mtk_claim_iso_intf
   btusb_mtk_setup
   hci_dev_open_sync
   hci_power_on
   process_scheduled_works
   worker_thread
   kthread

With the above call trace the device lock hasn't been claimed. Claim
it.

Without this fix, we'd sometimes see the error "Failed to claim iso
interface". Sometimes we'd even see worse errors, like a NULL pointer
dereference (where `intf->dev.driver` was NULL) with a trace like:

  Call trace:
   usb_suspend_both
   usb_runtime_suspend
   __rpm_callback
   rpm_suspend
   pm_runtime_work
   process_scheduled_works

Both errors appear to be fixed with the proper locking.

Fixes: ceac1cb0 ("Bluetooth: btusb: mediatek: add ISO data transmission functions")
Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
(cherry picked from commit ec5570088c6aff8aecce998bf3aec4b9381dfa62
 git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master)

BUG=b:390289984
TEST=git diff

Change-Id: I3cddc490ba37624163727fdb04370c9a12b10879
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/6187681


Tested-by: default avatarDouglas Anderson <dianders@chromium.org>
Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
Commit-Queue: ChromeOS Auto Retry <chromeos-auto-retry@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: default avatarSean Paul <sean@poorly.run>
Signed-off-by: default avatarHubert Mazur <hmazur@google.com>
parent 958ad3b8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment