]> www.infradead.org Git - users/hch/misc.git/commitdiff
Bluetooth: ISO: Don't initiate CIS connections if there are no buffers
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 27 Jun 2025 15:18:29 +0000 (11:18 -0400)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Sat, 27 Sep 2025 15:37:00 +0000 (11:37 -0400)
If the controller has no buffers left return -ENOBUFF to indicate that
iso_cnt might be out of sync.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
net/bluetooth/iso.c

index 5ce823ca3aaf4406ae66d34e1cbfbfe608d5984e..ac6e83313b9b68b22e6af233eb67ab9c5e9d8a9d 100644 (file)
@@ -458,6 +458,13 @@ static int iso_connect_cis(struct sock *sk)
                goto unlock;
        }
 
+       /* Check if there are available buffers for output/TX. */
+       if (iso_pi(sk)->qos.ucast.out.sdu && !hci_iso_count(hdev) &&
+           (hdev->iso_pkts && !hdev->iso_cnt)) {
+               err = -ENOBUFS;
+               goto unlock;
+       }
+
        /* Just bind if DEFER_SETUP has been set */
        if (test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) {
                hcon = hci_bind_cis(hdev, &iso_pi(sk)->dst,