Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'bluetooth-fixes-from-next'

Cherry-pick what looks like safe fixes from the bluetooth
net-next PR. The other changes will have to wait for 6.6

Link: https://lore.kernel.org/all/20230627191004.2586540-1-luiz.dentz@gmail.com/
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+130 -66
+1 -1
drivers/bluetooth/btqca.c
··· 637 637 snprintf(config.fwname, sizeof(config.fwname), 638 638 "qca/%s", firmware_name); 639 639 else if (qca_is_wcn399x(soc_type)) { 640 - if (ver.soc_id == QCA_WCN3991_SOC_ID) { 640 + if (le32_to_cpu(ver.soc_id) == QCA_WCN3991_SOC_ID) { 641 641 snprintf(config.fwname, sizeof(config.fwname), 642 642 "qca/crnv%02xu.bin", rom_ver); 643 643 } else {
+16 -2
drivers/bluetooth/btrtl.c
··· 1367 1367 MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_config.bin"); 1368 1368 MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_fw.bin"); 1369 1369 MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_config.bin"); 1370 + MODULE_FIRMWARE("rtl_bt/rtl8723d_fw.bin"); 1371 + MODULE_FIRMWARE("rtl_bt/rtl8723d_config.bin"); 1370 1372 MODULE_FIRMWARE("rtl_bt/rtl8723ds_fw.bin"); 1371 1373 MODULE_FIRMWARE("rtl_bt/rtl8723ds_config.bin"); 1372 1374 MODULE_FIRMWARE("rtl_bt/rtl8761a_fw.bin"); 1373 1375 MODULE_FIRMWARE("rtl_bt/rtl8761a_config.bin"); 1376 + MODULE_FIRMWARE("rtl_bt/rtl8761b_fw.bin"); 1377 + MODULE_FIRMWARE("rtl_bt/rtl8761b_config.bin"); 1378 + MODULE_FIRMWARE("rtl_bt/rtl8761bu_fw.bin"); 1379 + MODULE_FIRMWARE("rtl_bt/rtl8761bu_config.bin"); 1374 1380 MODULE_FIRMWARE("rtl_bt/rtl8821a_fw.bin"); 1375 1381 MODULE_FIRMWARE("rtl_bt/rtl8821a_config.bin"); 1382 + MODULE_FIRMWARE("rtl_bt/rtl8821c_fw.bin"); 1383 + MODULE_FIRMWARE("rtl_bt/rtl8821c_config.bin"); 1384 + MODULE_FIRMWARE("rtl_bt/rtl8821cs_fw.bin"); 1385 + MODULE_FIRMWARE("rtl_bt/rtl8821cs_config.bin"); 1376 1386 MODULE_FIRMWARE("rtl_bt/rtl8822b_fw.bin"); 1377 1387 MODULE_FIRMWARE("rtl_bt/rtl8822b_config.bin"); 1388 + MODULE_FIRMWARE("rtl_bt/rtl8822cs_fw.bin"); 1389 + MODULE_FIRMWARE("rtl_bt/rtl8822cs_config.bin"); 1390 + MODULE_FIRMWARE("rtl_bt/rtl8822cu_fw.bin"); 1391 + MODULE_FIRMWARE("rtl_bt/rtl8822cu_config.bin"); 1392 + MODULE_FIRMWARE("rtl_bt/rtl8851bu_fw.bin"); 1393 + MODULE_FIRMWARE("rtl_bt/rtl8851bu_config.bin"); 1378 1394 MODULE_FIRMWARE("rtl_bt/rtl8852au_fw.bin"); 1379 1395 MODULE_FIRMWARE("rtl_bt/rtl8852au_config.bin"); 1380 1396 MODULE_FIRMWARE("rtl_bt/rtl8852bs_fw.bin"); ··· 1399 1383 MODULE_FIRMWARE("rtl_bt/rtl8852bu_config.bin"); 1400 1384 MODULE_FIRMWARE("rtl_bt/rtl8852cu_fw.bin"); 1401 1385 MODULE_FIRMWARE("rtl_bt/rtl8852cu_config.bin"); 1402 - MODULE_FIRMWARE("rtl_bt/rtl8851bu_fw.bin"); 1403 - MODULE_FIRMWARE("rtl_bt/rtl8851bu_config.bin");
+5
drivers/bluetooth/btusb.c
··· 613 613 { USB_DEVICE(0x0489, 0xe0d9), .driver_info = BTUSB_MEDIATEK | 614 614 BTUSB_WIDEBAND_SPEECH | 615 615 BTUSB_VALID_LE_STATES }, 616 + { USB_DEVICE(0x0489, 0xe0f5), .driver_info = BTUSB_MEDIATEK | 617 + BTUSB_WIDEBAND_SPEECH | 618 + BTUSB_VALID_LE_STATES }, 616 619 { USB_DEVICE(0x13d3, 0x3568), .driver_info = BTUSB_MEDIATEK | 617 620 BTUSB_WIDEBAND_SPEECH | 618 621 BTUSB_VALID_LE_STATES }, ··· 657 654 { USB_DEVICE(0x2550, 0x8761), .driver_info = BTUSB_REALTEK | 658 655 BTUSB_WIDEBAND_SPEECH }, 659 656 { USB_DEVICE(0x0bda, 0x8771), .driver_info = BTUSB_REALTEK | 657 + BTUSB_WIDEBAND_SPEECH }, 658 + { USB_DEVICE(0x6655, 0x8771), .driver_info = BTUSB_REALTEK | 660 659 BTUSB_WIDEBAND_SPEECH }, 661 660 { USB_DEVICE(0x7392, 0xc611), .driver_info = BTUSB_REALTEK | 662 661 BTUSB_WIDEBAND_SPEECH },
+2 -1
drivers/bluetooth/hci_bcm.c
··· 643 643 * Allow the bootloader to set a valid address through the 644 644 * device tree. 645 645 */ 646 - set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hu->hdev->quirks); 646 + if (test_bit(HCI_QUIRK_INVALID_BDADDR, &hu->hdev->quirks)) 647 + set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hu->hdev->quirks); 647 648 648 649 if (!bcm_request_irq(bcm)) 649 650 err = bcm_setup_sleep(hu);
+1 -1
include/net/bluetooth/bluetooth.h
··· 185 185 struct bt_iso_bcast_qos { 186 186 __u8 big; 187 187 __u8 bis; 188 - __u8 sync_interval; 188 + __u8 sync_factor; 189 189 __u8 packing; 190 190 __u8 framing; 191 191 struct bt_iso_io_qos in;
+1
include/net/bluetooth/mgmt.h
··· 979 979 #define MGMT_DEV_FOUND_NOT_CONNECTABLE BIT(2) 980 980 #define MGMT_DEV_FOUND_INITIATED_CONN BIT(3) 981 981 #define MGMT_DEV_FOUND_NAME_REQUEST_FAILED BIT(4) 982 + #define MGMT_DEV_FOUND_SCAN_RSP BIT(5) 982 983 983 984 #define MGMT_EV_DEVICE_FOUND 0x0012 984 985 struct mgmt_ev_device_found {
+39 -10
net/bluetooth/hci_conn.c
··· 775 775 hci_abort_conn(conn, HCI_ERROR_REMOTE_USER_TERM); 776 776 } 777 777 778 + struct iso_cig_params { 779 + struct hci_cp_le_set_cig_params cp; 780 + struct hci_cis_params cis[0x1f]; 781 + }; 782 + 778 783 struct iso_list_data { 779 784 union { 780 785 u8 cig; ··· 791 786 u16 sync_handle; 792 787 }; 793 788 int count; 794 - struct { 795 - struct hci_cp_le_set_cig_params cp; 796 - struct hci_cis_params cis[0x11]; 797 - } pdu; 789 + struct iso_cig_params pdu; 798 790 }; 799 791 800 792 static void bis_list(struct hci_conn *conn, void *data) ··· 1766 1764 return hci_send_cmd(hdev, HCI_OP_LE_CREATE_BIG, sizeof(cp), &cp); 1767 1765 } 1768 1766 1767 + static void set_cig_params_complete(struct hci_dev *hdev, void *data, int err) 1768 + { 1769 + struct iso_cig_params *pdu = data; 1770 + 1771 + bt_dev_dbg(hdev, ""); 1772 + 1773 + if (err) 1774 + bt_dev_err(hdev, "Unable to set CIG parameters: %d", err); 1775 + 1776 + kfree(pdu); 1777 + } 1778 + 1779 + static int set_cig_params_sync(struct hci_dev *hdev, void *data) 1780 + { 1781 + struct iso_cig_params *pdu = data; 1782 + u32 plen; 1783 + 1784 + plen = sizeof(pdu->cp) + pdu->cp.num_cis * sizeof(pdu->cis[0]); 1785 + return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_CIG_PARAMS, plen, pdu, 1786 + HCI_CMD_TIMEOUT); 1787 + } 1788 + 1769 1789 static bool hci_le_set_cig_params(struct hci_conn *conn, struct bt_iso_qos *qos) 1770 1790 { 1771 1791 struct hci_dev *hdev = conn->hdev; 1772 1792 struct iso_list_data data; 1793 + struct iso_cig_params *pdu; 1773 1794 1774 1795 memset(&data, 0, sizeof(data)); 1775 1796 ··· 1862 1837 if (qos->ucast.cis == BT_ISO_QOS_CIS_UNSET || !data.pdu.cp.num_cis) 1863 1838 return false; 1864 1839 1865 - if (hci_send_cmd(hdev, HCI_OP_LE_SET_CIG_PARAMS, 1866 - sizeof(data.pdu.cp) + 1867 - (data.pdu.cp.num_cis * sizeof(*data.pdu.cis)), 1868 - &data.pdu) < 0) 1840 + pdu = kmemdup(&data.pdu, sizeof(*pdu), GFP_KERNEL); 1841 + if (!pdu) 1869 1842 return false; 1843 + 1844 + if (hci_cmd_sync_queue(hdev, set_cig_params_sync, pdu, 1845 + set_cig_params_complete) < 0) { 1846 + kfree(pdu); 1847 + return false; 1848 + } 1870 1849 1871 1850 return true; 1872 1851 } ··· 2073 2044 flags |= MGMT_ADV_FLAG_SEC_2M; 2074 2045 2075 2046 /* Align intervals */ 2076 - interval = qos->bcast.out.interval / 1250; 2047 + interval = (qos->bcast.out.interval / 1250) * qos->bcast.sync_factor; 2077 2048 2078 2049 if (qos->bcast.bis) 2079 - sync_interval = qos->bcast.sync_interval * 1600; 2050 + sync_interval = interval * 4; 2080 2051 2081 2052 err = hci_start_per_adv_sync(hdev, qos->bcast.bis, conn->le_per_adv_data_len, 2082 2053 conn->le_per_adv_data, flags, interval,
+39 -24
net/bluetooth/hci_event.c
··· 3812 3812 bt_dev_dbg(hdev, "status 0x%2.2x", rp->status); 3813 3813 3814 3814 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_CIG_PARAMS); 3815 - if (!cp || rp->num_handles != cp->num_cis || rp->cig_id != cp->cig_id) { 3815 + if (!rp->status && (!cp || rp->num_handles != cp->num_cis || 3816 + rp->cig_id != cp->cig_id)) { 3816 3817 bt_dev_err(hdev, "unexpected Set CIG Parameters response data"); 3817 3818 status = HCI_ERROR_UNSPECIFIED; 3818 3819 } ··· 6317 6316 return; 6318 6317 } 6319 6318 6320 - /* When receiving non-connectable or scannable undirected 6321 - * advertising reports, this means that the remote device is 6322 - * not connectable and then clearly indicate this in the 6323 - * device found event. 6324 - * 6325 - * When receiving a scan response, then there is no way to 6319 + /* When receiving a scan response, then there is no way to 6326 6320 * know if the remote device is connectable or not. However 6327 6321 * since scan responses are merged with a previously seen 6328 6322 * advertising report, the flags field from that report 6329 6323 * will be used. 6330 6324 * 6331 - * In the really unlikely case that a controller get confused 6332 - * and just sends a scan response event, then it is marked as 6333 - * not connectable as well. 6325 + * In the unlikely case that a controller just sends a scan 6326 + * response event that doesn't match the pending report, then 6327 + * it is marked as a standalone SCAN_RSP. 6334 6328 */ 6335 6329 if (type == LE_ADV_SCAN_RSP) 6336 - flags = MGMT_DEV_FOUND_NOT_CONNECTABLE; 6330 + flags = MGMT_DEV_FOUND_SCAN_RSP; 6337 6331 6338 6332 /* If there's nothing pending either store the data from this 6339 6333 * event or send an immediate device found event if the data ··· 6786 6790 { 6787 6791 struct hci_evt_le_cis_established *ev = data; 6788 6792 struct hci_conn *conn; 6793 + struct bt_iso_qos *qos; 6789 6794 u16 handle = __le16_to_cpu(ev->handle); 6790 6795 6791 6796 bt_dev_dbg(hdev, "status 0x%2.2x", ev->status); ··· 6808 6811 goto unlock; 6809 6812 } 6810 6813 6811 - if (conn->role == HCI_ROLE_SLAVE) { 6812 - __le32 interval; 6814 + qos = &conn->iso_qos; 6813 6815 6814 - memset(&interval, 0, sizeof(interval)); 6816 + /* Convert ISO Interval (1.25 ms slots) to SDU Interval (us) */ 6817 + qos->ucast.in.interval = le16_to_cpu(ev->interval) * 1250; 6818 + qos->ucast.out.interval = qos->ucast.in.interval; 6815 6819 6816 - memcpy(&interval, ev->c_latency, sizeof(ev->c_latency)); 6817 - conn->iso_qos.ucast.in.interval = le32_to_cpu(interval); 6818 - memcpy(&interval, ev->p_latency, sizeof(ev->p_latency)); 6819 - conn->iso_qos.ucast.out.interval = le32_to_cpu(interval); 6820 - conn->iso_qos.ucast.in.latency = le16_to_cpu(ev->interval); 6821 - conn->iso_qos.ucast.out.latency = le16_to_cpu(ev->interval); 6822 - conn->iso_qos.ucast.in.sdu = le16_to_cpu(ev->c_mtu); 6823 - conn->iso_qos.ucast.out.sdu = le16_to_cpu(ev->p_mtu); 6824 - conn->iso_qos.ucast.in.phy = ev->c_phy; 6825 - conn->iso_qos.ucast.out.phy = ev->p_phy; 6820 + switch (conn->role) { 6821 + case HCI_ROLE_SLAVE: 6822 + /* Convert Transport Latency (us) to Latency (msec) */ 6823 + qos->ucast.in.latency = 6824 + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->c_latency), 6825 + 1000); 6826 + qos->ucast.out.latency = 6827 + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->p_latency), 6828 + 1000); 6829 + qos->ucast.in.sdu = le16_to_cpu(ev->c_mtu); 6830 + qos->ucast.out.sdu = le16_to_cpu(ev->p_mtu); 6831 + qos->ucast.in.phy = ev->c_phy; 6832 + qos->ucast.out.phy = ev->p_phy; 6833 + break; 6834 + case HCI_ROLE_MASTER: 6835 + /* Convert Transport Latency (us) to Latency (msec) */ 6836 + qos->ucast.out.latency = 6837 + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->c_latency), 6838 + 1000); 6839 + qos->ucast.in.latency = 6840 + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->p_latency), 6841 + 1000); 6842 + qos->ucast.out.sdu = le16_to_cpu(ev->c_mtu); 6843 + qos->ucast.in.sdu = le16_to_cpu(ev->p_mtu); 6844 + qos->ucast.out.phy = ev->c_phy; 6845 + qos->ucast.in.phy = ev->p_phy; 6846 + break; 6826 6847 } 6827 6848 6828 6849 if (!ev->status) {
+10 -18
net/bluetooth/hci_sync.c
··· 4623 4623 * BD_ADDR invalid before creating the HCI device or in 4624 4624 * its setup callback. 4625 4625 */ 4626 - invalid_bdaddr = test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); 4627 - 4626 + invalid_bdaddr = test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks) || 4627 + test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); 4628 4628 if (!ret) { 4629 - if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks)) { 4630 - if (!bacmp(&hdev->public_addr, BDADDR_ANY)) 4631 - hci_dev_get_bd_addr_from_property(hdev); 4629 + if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks) && 4630 + !bacmp(&hdev->public_addr, BDADDR_ANY)) 4631 + hci_dev_get_bd_addr_from_property(hdev); 4632 4632 4633 - if (bacmp(&hdev->public_addr, BDADDR_ANY) && 4634 - hdev->set_bdaddr) { 4635 - ret = hdev->set_bdaddr(hdev, 4636 - &hdev->public_addr); 4637 - 4638 - /* If setting of the BD_ADDR from the device 4639 - * property succeeds, then treat the address 4640 - * as valid even if the invalid BD_ADDR 4641 - * quirk indicates otherwise. 4642 - */ 4643 - if (!ret) 4644 - invalid_bdaddr = false; 4645 - } 4633 + if (invalid_bdaddr && bacmp(&hdev->public_addr, BDADDR_ANY) && 4634 + hdev->set_bdaddr) { 4635 + ret = hdev->set_bdaddr(hdev, &hdev->public_addr); 4636 + if (!ret) 4637 + invalid_bdaddr = false; 4646 4638 } 4647 4639 } 4648 4640
+7 -7
net/bluetooth/hci_sysfs.c
··· 6 6 #include <net/bluetooth/bluetooth.h> 7 7 #include <net/bluetooth/hci_core.h> 8 8 9 - static struct class *bt_class; 9 + static const struct class bt_class = { 10 + .name = "bluetooth", 11 + }; 10 12 11 13 static void bt_link_release(struct device *dev) 12 14 { ··· 38 36 BT_DBG("conn %p", conn); 39 37 40 38 conn->dev.type = &bt_link; 41 - conn->dev.class = bt_class; 39 + conn->dev.class = &bt_class; 42 40 conn->dev.parent = &hdev->dev; 43 41 44 42 device_initialize(&conn->dev); ··· 106 104 struct device *dev = &hdev->dev; 107 105 108 106 dev->type = &bt_host; 109 - dev->class = bt_class; 107 + dev->class = &bt_class; 110 108 111 109 __module_get(THIS_MODULE); 112 110 device_initialize(dev); ··· 114 112 115 113 int __init bt_sysfs_init(void) 116 114 { 117 - bt_class = class_create("bluetooth"); 118 - 119 - return PTR_ERR_OR_ZERO(bt_class); 115 + return class_register(&bt_class); 120 116 } 121 117 122 118 void bt_sysfs_cleanup(void) 123 119 { 124 - class_destroy(bt_class); 120 + class_unregister(&bt_class); 125 121 }
+2 -2
net/bluetooth/iso.c
··· 704 704 .bcast = { 705 705 .big = BT_ISO_QOS_BIG_UNSET, 706 706 .bis = BT_ISO_QOS_BIS_UNSET, 707 - .sync_interval = 0x00, 707 + .sync_factor = 0x01, 708 708 .packing = 0x00, 709 709 .framing = 0x00, 710 710 .in = DEFAULT_IO_QOS, ··· 1213 1213 1214 1214 static bool check_bcast_qos(struct bt_iso_qos *qos) 1215 1215 { 1216 - if (qos->bcast.sync_interval > 0x07) 1216 + if (qos->bcast.sync_factor == 0x00) 1217 1217 return false; 1218 1218 1219 1219 if (qos->bcast.packing > 0x01)
+5
net/bluetooth/l2cap_core.c
··· 6374 6374 if (!chan) 6375 6375 goto done; 6376 6376 6377 + chan = l2cap_chan_hold_unless_zero(chan); 6378 + if (!chan) 6379 + goto done; 6380 + 6377 6381 l2cap_chan_lock(chan); 6378 6382 l2cap_chan_del(chan, ECONNREFUSED); 6379 6383 l2cap_chan_unlock(chan); 6384 + l2cap_chan_put(chan); 6380 6385 6381 6386 done: 6382 6387 mutex_unlock(&conn->chan_lock);
+2
net/bluetooth/l2cap_sock.c
··· 46 46 static void l2cap_sock_init(struct sock *sk, struct sock *parent); 47 47 static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, 48 48 int proto, gfp_t prio, int kern); 49 + static void l2cap_sock_cleanup_listen(struct sock *parent); 49 50 50 51 bool l2cap_is_socket(struct socket *sock) 51 52 { ··· 1416 1415 if (!sk) 1417 1416 return 0; 1418 1417 1418 + l2cap_sock_cleanup_listen(sk); 1419 1419 bt_sock_unlink(&l2cap_sk_list, sk); 1420 1420 1421 1421 err = l2cap_sock_shutdown(sock, SHUT_RDWR);