Skip to content

Commit 9767870

Browse files
committed
Merge tag 'for-net-2025-04-10' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth
Luiz Augusto von Dentz says: ==================== bluetooth pull request for net: - btrtl: Prevent potential NULL dereference - qca: fix NV variant for one of WCN3950 SoCs - l2cap: Check encryption key size on incoming connection - hci_event: Fix sending MGMT_EV_DEVICE_FOUND for invalid address - btnxpuart: Revert baudrate change in nxp_shutdown - btnxpuart: Add an error message if FW dump trigger fails - increment TX timestamping tskey always for stream sockets * tag 'for-net-2025-04-10' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth: Bluetooth: l2cap: Check encryption key size on incoming connection Bluetooth: btnxpuart: Add an error message if FW dump trigger fails Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown Bluetooth: increment TX timestamping tskey always for stream sockets Bluetooth: qca: fix NV variant for one of WCN3950 SoCs Bluetooth: btrtl: Prevent potential NULL dereference Bluetooth: hci_event: Fix sending MGMT_EV_DEVICE_FOUND for invalid address ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 18c889a + 522e9ed commit 9767870

File tree

6 files changed

+25
-16
lines changed

6 files changed

+25
-16
lines changed

drivers/bluetooth/btnxpuart.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,9 @@ static void nxp_coredump(struct hci_dev *hdev)
12861286
u8 pcmd = 2;
12871287

12881288
skb = nxp_drv_send_cmd(hdev, HCI_NXP_TRIGGER_DUMP, 1, &pcmd);
1289-
if (!IS_ERR(skb))
1289+
if (IS_ERR(skb))
1290+
bt_dev_err(hdev, "Failed to trigger FW Dump. (%ld)", PTR_ERR(skb));
1291+
else
12901292
kfree_skb(skb);
12911293
}
12921294

@@ -1445,9 +1447,6 @@ static int nxp_shutdown(struct hci_dev *hdev)
14451447
/* HCI_NXP_IND_RESET command may not returns any response */
14461448
if (!IS_ERR(skb))
14471449
kfree_skb(skb);
1448-
} else if (nxpdev->current_baudrate != nxpdev->fw_init_baudrate) {
1449-
nxpdev->new_baudrate = nxpdev->fw_init_baudrate;
1450-
nxp_set_baudrate_cmd(hdev, NULL);
14511450
}
14521451

14531452
return 0;
@@ -1799,13 +1798,15 @@ static void nxp_serdev_remove(struct serdev_device *serdev)
17991798
clear_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state);
18001799
wake_up_interruptible(&nxpdev->check_boot_sign_wait_q);
18011800
wake_up_interruptible(&nxpdev->fw_dnld_done_wait_q);
1802-
}
1803-
1804-
if (test_bit(HCI_RUNNING, &hdev->flags)) {
1805-
/* Ensure shutdown callback is executed before unregistering, so
1806-
* that baudrate is reset to initial value.
1801+
} else {
1802+
/* Restore FW baudrate to fw_init_baudrate if changed.
1803+
* This will ensure FW baudrate is in sync with
1804+
* driver baudrate in case this driver is re-inserted.
18071805
*/
1808-
nxp_shutdown(hdev);
1806+
if (nxpdev->current_baudrate != nxpdev->fw_init_baudrate) {
1807+
nxpdev->new_baudrate = nxpdev->fw_init_baudrate;
1808+
nxp_set_baudrate_cmd(hdev, NULL);
1809+
}
18091810
}
18101811

18111812
ps_cleanup(nxpdev);

drivers/bluetooth/btqca.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
889889
if (le32_to_cpu(ver.soc_id) == QCA_WCN3950_SOC_ID_T)
890890
variant = "t";
891891
else if (le32_to_cpu(ver.soc_id) == QCA_WCN3950_SOC_ID_S)
892-
variant = "u";
892+
variant = "s";
893893

894894
snprintf(config.fwname, sizeof(config.fwname),
895895
"qca/cmnv%02x%s.bin", rom_ver, variant);

drivers/bluetooth/btrtl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,8 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
12151215
rtl_dev_err(hdev, "mandatory config file %s not found",
12161216
btrtl_dev->ic_info->cfg_name);
12171217
ret = btrtl_dev->cfg_len;
1218+
if (!ret)
1219+
ret = -EINVAL;
12181220
goto err_free;
12191221
}
12201222
}

net/bluetooth/hci_conn.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3072,6 +3072,7 @@ void hci_setup_tx_timestamp(struct sk_buff *skb, size_t key_offset,
30723072
const struct sockcm_cookie *sockc)
30733073
{
30743074
struct sock *sk = skb ? skb->sk : NULL;
3075+
int key;
30753076

30763077
/* This shall be called on a single skb of those generated by user
30773078
* sendmsg(), and only when the sendmsg() does not return error to
@@ -3087,13 +3088,16 @@ void hci_setup_tx_timestamp(struct sk_buff *skb, size_t key_offset,
30873088

30883089
sock_tx_timestamp(sk, sockc, &skb_shinfo(skb)->tx_flags);
30893090

3091+
if (sk->sk_type == SOCK_STREAM)
3092+
key = atomic_add_return(key_offset, &sk->sk_tskey);
3093+
30903094
if (sockc->tsflags & SOF_TIMESTAMPING_OPT_ID &&
30913095
sockc->tsflags & SOF_TIMESTAMPING_TX_RECORD_MASK) {
30923096
if (sockc->tsflags & SOCKCM_FLAG_TS_OPT_ID) {
30933097
skb_shinfo(skb)->tskey = sockc->ts_opt_id;
30943098
} else {
3095-
int key = atomic_add_return(key_offset, &sk->sk_tskey);
3096-
3099+
if (sk->sk_type != SOCK_STREAM)
3100+
key = atomic_inc_return(&sk->sk_tskey);
30973101
skb_shinfo(skb)->tskey = key - 1;
30983102
}
30993103
}

net/bluetooth/hci_event.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6160,11 +6160,12 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
61606160
* event or send an immediate device found event if the data
61616161
* should not be stored for later.
61626162
*/
6163-
if (!ext_adv && !has_pending_adv_report(hdev)) {
6163+
if (!has_pending_adv_report(hdev)) {
61646164
/* If the report will trigger a SCAN_REQ store it for
61656165
* later merging.
61666166
*/
6167-
if (type == LE_ADV_IND || type == LE_ADV_SCAN_IND) {
6167+
if (!ext_adv && (type == LE_ADV_IND ||
6168+
type == LE_ADV_SCAN_IND)) {
61686169
store_pending_adv_report(hdev, bdaddr, bdaddr_type,
61696170
rssi, flags, data, len);
61706171
return;

net/bluetooth/l2cap_core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3991,7 +3991,8 @@ static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,
39913991

39923992
/* Check if the ACL is secure enough (if not SDP) */
39933993
if (psm != cpu_to_le16(L2CAP_PSM_SDP) &&
3994-
!hci_conn_check_link_mode(conn->hcon)) {
3994+
(!hci_conn_check_link_mode(conn->hcon) ||
3995+
!l2cap_check_enc_key_size(conn->hcon))) {
39953996
conn->disc_reason = HCI_ERROR_AUTH_FAILURE;
39963997
result = L2CAP_CR_SEC_BLOCK;
39973998
goto response;

0 commit comments

Comments
 (0)