]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:37:33 +0000 (15:37 -0500)
[ Upstream commit d79c7d01f1c8bcf9a48337c8960d618fbe31fc0c ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/iso.c

index 6e2923b301505764f9be749173b7aeb2310408ac..3b2a4a9d79d615f3fc8fd0b8a61a8957970c9905 100644 (file)
@@ -460,6 +460,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,