]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Bluetooth: hci_conn: Fix not restoring ISO buffer count on disconnect
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 17 Oct 2022 22:36:23 +0000 (15:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2022 17:17:21 +0000 (18:17 +0100)
[ Upstream commit 5638d9ea9c01c77fc11693d48cf719bc7e88f224 ]

When disconnecting an ISO link the controller may not generate
HCI_EV_NUM_COMP_PKTS for unacked packets which needs to be restored in
hci_conn_del otherwise the host would assume they are still in use and
would not be able to use all the buffers available.

Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tested-by: Frédéric Danis <frederic.danis@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/hci_conn.c

index f1263cdd71ddfbc75945a5116c9b53173d2dd6fa..f26ed278d9e3c97d6632fd3982ad11206a8eae69 100644 (file)
@@ -1003,10 +1003,21 @@ int hci_conn_del(struct hci_conn *conn)
                        hdev->acl_cnt += conn->sent;
        } else {
                struct hci_conn *acl = conn->link;
+
                if (acl) {
                        acl->link = NULL;
                        hci_conn_drop(acl);
                }
+
+               /* Unacked ISO frames */
+               if (conn->type == ISO_LINK) {
+                       if (hdev->iso_pkts)
+                               hdev->iso_cnt += conn->sent;
+                       else if (hdev->le_pkts)
+                               hdev->le_cnt += conn->sent;
+                       else
+                               hdev->acl_cnt += conn->sent;
+               }
        }
 
        if (conn->amp_mgr)