Skip to content

Commit d7f513a

Browse files
committed
Merge tag 'for-net-2024-10-16' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth
Pull bluetooth fixes from Luiz Augusto Von Dentz: - ISO: Fix multiple init when debugfs is disabled - Call iso_exit() on module unload - Remove debugfs directory on module init failure - btusb: Fix not being able to reconnect after suspend - btusb: Fix regression with fake CSR controllers 0a12:0001 - bnep: fix wild-memory-access in proto_unregister Note: normally the bluetooth fixes go through the networking tree, but this missed the weekly merge, and two of the commits fix regressions that have caused a fair amount of noise and have now hit stable too: https://lore.kernel.org/all/[email protected]/ So I'm pulling it directly just to expedite things and not miss yet another -rc release. This is not meant to become a new pattern. * tag 'for-net-2024-10-16' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth: Bluetooth: btusb: Fix regression with fake CSR controllers 0a12:0001 Bluetooth: bnep: fix wild-memory-access in proto_unregister Bluetooth: btusb: Fix not being able to reconnect after suspend Bluetooth: Remove debugfs directory on module init failure Bluetooth: Call iso_exit() on module unload Bluetooth: ISO: Fix multiple init when debugfs is disabled
2 parents dd4f503 + 2c1dda2 commit d7f513a

File tree

4 files changed

+14
-25
lines changed

4 files changed

+14
-25
lines changed

drivers/bluetooth/btusb.c

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,10 +1345,15 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags)
13451345
if (!urb)
13461346
return -ENOMEM;
13471347

1348-
/* Use maximum HCI Event size so the USB stack handles
1349-
* ZPL/short-transfer automatically.
1350-
*/
1351-
size = HCI_MAX_EVENT_SIZE;
1348+
if (le16_to_cpu(data->udev->descriptor.idVendor) == 0x0a12 &&
1349+
le16_to_cpu(data->udev->descriptor.idProduct) == 0x0001)
1350+
/* Fake CSR devices don't seem to support sort-transter */
1351+
size = le16_to_cpu(data->intr_ep->wMaxPacketSize);
1352+
else
1353+
/* Use maximum HCI Event size so the USB stack handles
1354+
* ZPL/short-transfer automatically.
1355+
*/
1356+
size = HCI_MAX_EVENT_SIZE;
13521357

13531358
buf = kmalloc(size, mem_flags);
13541359
if (!buf) {
@@ -4038,7 +4043,6 @@ static void btusb_disconnect(struct usb_interface *intf)
40384043
static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
40394044
{
40404045
struct btusb_data *data = usb_get_intfdata(intf);
4041-
int err;
40424046

40434047
BT_DBG("intf %p", intf);
40444048

@@ -4051,24 +4055,13 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
40514055
if (data->suspend_count++)
40524056
return 0;
40534057

4054-
/* Notify Host stack to suspend; this has to be done before stopping
4055-
* the traffic since the hci_suspend_dev itself may generate some
4056-
* traffic.
4057-
*/
4058-
err = hci_suspend_dev(data->hdev);
4059-
if (err) {
4060-
data->suspend_count--;
4061-
return err;
4062-
}
4063-
40644058
spin_lock_irq(&data->txlock);
40654059
if (!(PMSG_IS_AUTO(message) && data->tx_in_flight)) {
40664060
set_bit(BTUSB_SUSPENDING, &data->flags);
40674061
spin_unlock_irq(&data->txlock);
40684062
} else {
40694063
spin_unlock_irq(&data->txlock);
40704064
data->suspend_count--;
4071-
hci_resume_dev(data->hdev);
40724065
return -EBUSY;
40734066
}
40744067

@@ -4189,8 +4182,6 @@ static int btusb_resume(struct usb_interface *intf)
41894182
spin_unlock_irq(&data->txlock);
41904183
schedule_work(&data->work);
41914184

4192-
hci_resume_dev(data->hdev);
4193-
41944185
return 0;
41954186

41964187
failed:

net/bluetooth/af_bluetooth.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,11 +825,14 @@ static int __init bt_init(void)
825825
bt_sysfs_cleanup();
826826
cleanup_led:
827827
bt_leds_cleanup();
828+
debugfs_remove_recursive(bt_debugfs);
828829
return err;
829830
}
830831

831832
static void __exit bt_exit(void)
832833
{
834+
iso_exit();
835+
833836
mgmt_exit();
834837

835838
sco_exit();

net/bluetooth/bnep/core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,7 @@ static int __init bnep_init(void)
745745
if (flt[0])
746746
BT_INFO("BNEP filters: %s", flt);
747747

748-
bnep_sock_init();
749-
return 0;
748+
return bnep_sock_init();
750749
}
751750

752751
static void __exit bnep_exit(void)

net/bluetooth/iso.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,13 +2301,9 @@ int iso_init(void)
23012301

23022302
hci_register_cb(&iso_cb);
23032303

2304-
if (IS_ERR_OR_NULL(bt_debugfs))
2305-
return 0;
2306-
2307-
if (!iso_debugfs) {
2304+
if (!IS_ERR_OR_NULL(bt_debugfs))
23082305
iso_debugfs = debugfs_create_file("iso", 0444, bt_debugfs,
23092306
NULL, &iso_debugfs_fops);
2310-
}
23112307

23122308
iso_inited = true;
23132309

0 commit comments

Comments
 (0)