From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D02315CAE for ; Tue, 8 Nov 2022 14:11:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F96EC433D6; Tue, 8 Nov 2022 14:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1667916662; bh=P6AJxUjjRryYD3kAoJY3Gnv2bok1RuoUoMdFn/EsW7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E0I7djlDj/RDiCQWxxEsLguanGKnfo5wF2KkeUjFgsXrolCb//atM2zWsgdNrvRX1 LHGVlOud6fslC7hUp88R5R2ZpbtuwbqQHyRdrKuiWI8Nqob4W9QQm5eNUD6iAoAGRr 4ASzb82HSAMiNFiMNnmMglXHvr962O3ZpOvqLVAY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Luiz Augusto von Dentz , =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= , Sasha Levin Subject: [PATCH 6.0 054/197] Bluetooth: hci_conn: Fix not restoring ISO buffer count on disconnect Date: Tue, 8 Nov 2022 14:38:12 +0100 Message-Id: <20221108133357.267877717@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221108133354.787209461@linuxfoundation.org> References: <20221108133354.787209461@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Luiz Augusto von Dentz [ 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 Tested-by: Frédéric Danis Signed-off-by: Sasha Levin --- net/bluetooth/hci_conn.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index f1263cdd71dd..f26ed278d9e3 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -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) -- 2.35.1