Skip to content

Commit fde9836

Browse files
committed
Merge tag 'for-net-2025-02-21' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth
Luiz Augusto von Dentz says: ==================== bluetooth pull request for net: - btusb: Always allow SCO packets for user channel - L2CAP: Fix L2CAP_ECRED_CONN_RSP response * tag 'for-net-2025-02-21' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth: Bluetooth: L2CAP: Fix L2CAP_ECRED_CONN_RSP response Bluetooth: Always allow SCO packets for user channel ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents b282c54 + b25120e commit fde9836

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

drivers/bluetooth/btusb.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,7 +2102,8 @@ static int btusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
21022102
return submit_or_queue_tx_urb(hdev, urb);
21032103

21042104
case HCI_SCODATA_PKT:
2105-
if (hci_conn_num(hdev, SCO_LINK) < 1)
2105+
if (!hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
2106+
hci_conn_num(hdev, SCO_LINK) < 1)
21062107
return -ENODEV;
21072108

21082109
urb = alloc_isoc_urb(hdev, skb);
@@ -2576,7 +2577,8 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb)
25762577
return submit_or_queue_tx_urb(hdev, urb);
25772578

25782579
case HCI_SCODATA_PKT:
2579-
if (hci_conn_num(hdev, SCO_LINK) < 1)
2580+
if (!hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
2581+
hci_conn_num(hdev, SCO_LINK) < 1)
25802582
return -ENODEV;
25812583

25822584
urb = alloc_isoc_urb(hdev, skb);

net/bluetooth/l2cap_core.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,8 @@ void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
632632
test_bit(FLAG_HOLD_HCI_CONN, &chan->flags))
633633
hci_conn_hold(conn->hcon);
634634

635-
list_add(&chan->list, &conn->chan_l);
635+
/* Append to the list since the order matters for ECRED */
636+
list_add_tail(&chan->list, &conn->chan_l);
636637
}
637638

638639
void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
@@ -3771,7 +3772,11 @@ static void l2cap_ecred_rsp_defer(struct l2cap_chan *chan, void *data)
37713772
struct l2cap_ecred_conn_rsp *rsp_flex =
37723773
container_of(&rsp->pdu.rsp, struct l2cap_ecred_conn_rsp, hdr);
37733774

3774-
if (test_bit(FLAG_ECRED_CONN_REQ_SENT, &chan->flags))
3775+
/* Check if channel for outgoing connection or if it wasn't deferred
3776+
* since in those cases it must be skipped.
3777+
*/
3778+
if (test_bit(FLAG_ECRED_CONN_REQ_SENT, &chan->flags) ||
3779+
!test_and_clear_bit(FLAG_DEFER_SETUP, &chan->flags))
37753780
return;
37763781

37773782
/* Reset ident so only one response is sent */

0 commit comments

Comments
 (0)