From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385390; b=WOhhPGc+BO1yG3DKPIbgsj+mnf8EHJ6gyNyur1X+f8dv4+tPHN8ETEkEWdqCEK3TXYll C5hE56IZDa+Pg4o0kKpl0ihCTcSgGVPeTOWShiVGMg58RPgrgy3ouL/v05snuBQd792FY zl2c619i/TxqN13f2u7Mq2TL6f+5fkiWDmDpFlF3drHw7AZffdvDDdzPNwYvqfwynEjud PLOEihR63m8xxocZRFYnkF1f4xy5P0FAvqO4wH//yEmXA5m2kuPQXUBIiYuv4rOEsn4Rd o2jen0L60aJFSsx4Cj796Td0+6713gNQtlTaPguPRGoGbY70+rY+Kuit1Oo4vygdZGw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385390; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=0drdp/ykgStkwKQulk+qYW841gzFIXUtEcTzTRKkTGA=; b=YIrEs+ELXFg9mW9JsS0aqCGVTAn/EhaPyOL6e1T/WOB3aXaJ077geKQfspFw4Hpw44XU GsUbEZm/kakbU0IL5U/mMlfKIq6i/xjWJv45QpsNo+2GfDcazUKRXWCQ4O5y8zEHQenJa 8aL0rgqnNDpcJPQIoUJ24Y+c+xY0wiq95d1G5uEvHPx8SIdtIHKdlF6xJtwzLlhMqr0h9 S60D1qku+ASbPFTUZwAn5kkyWI2Z0ixpzaIJU3OOh7EkS1hDpUZ9x01oZdM8iuMNE8Aze WcjZNK/2hGLJqGgxlv4RQNSbstfzr7xvQ28j6BJlk/1KYQnjddn0YgGdY6uPHlA26ZA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=dDgaGGnT; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1B47606A322; Fri, 4 Dec 2026 11:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=dDgaGGnT Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D6C01F000CE; Fri, 4 Dec 2026 11:56:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385390; bh=0drdp/ykgStkwKQulk+qYW841gzFIXUtEcTzTRKkTGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dDgaGGnTmXmVOd9jeYIBl2Ld1P21e+ZoEG6RtPIKSOKmS3JYcz/5X4QQX/g+FTKaB LOQSS3jXY/GwUAN/cF9ZTx6pIzDLBN2Ii0FsdTT46uOePL4DdKAuxrGpbyZDLDLZMy t4ik7X/WgChpbv3Q78Ztrjk7SJr7yoXEGcN505OY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhao Li , Luiz Augusto von Dentz Subject: [PATCH 6.6 0536/1167] Bluetooth: L2CAP: Keep recvmsg from resuming a closed channel Date: Fri, 4 Dec 2026 18:59:23 +0900 Message-ID: <20261204100716.014528463@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhao Li commit 1f2ac56137c51be0601e18a163d817e02a15913f upstream. Reading buffered ERTM data after ACL link loss can clear local busy and send a supervisory frame after l2cap_conn_del() has destroyed the HCI channel, which oopses on a NULL pointer in hci_send_acl(). The socket still owns its L2CAP channel, so its lifetime does not protect the underlying HCI channel. Require BT_CONNECTED before clearing local busy in recvmsg. The socket lock already held here serializes this check and send with teardown, which closes the socket before the HCI channel is destroyed. Continue to allow buffered data to be read after disconnection. AI assistance was used. Fixes: 61aa4f5b9f43 ("Bluetooth: Use the transmit state machine for busy state changes") Cc: stable@vger.kernel.org # needs adjustments for 5.15 Signed-off-by: Zhao Li Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/l2cap_sock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c @@ -1273,7 +1273,8 @@ static int l2cap_sock_recvmsg(struct soc * available. This avoids resending large numbers of * frames. */ - if (test_bit(CONN_LOCAL_BUSY, &pi->chan->conn_state) && + if (sk->sk_state == BT_CONNECTED && + test_bit(CONN_LOCAL_BUSY, &pi->chan->conn_state) && atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf >> 1) l2cap_chan_busy(pi->chan, 0);