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=1796388173; b=SpR316Ji4vq5rhWdYkTqRo0CzmGngGfRlfU0/0niluKH2Pet5HOWk3JzWGqpAd8+hAEk jayHLvR/saM3jZLvyza3wIAOXFFaAiAnhjPQVy4BYB8wSHOZXsUcoVALfd/cFwswFtvp4 JJAcTdyTMv/ck+0KukEOC+MdwEsZaBShnuq35sogNMY+4X/NAXroT0t9w+ObThbtCaXXd HfUnfq58ypyDKJ1s2lrYhmvlyJhkg4Weg2w0Go9blbOBx7imah2XStfo+SfR/qmAqDSs1 7jsg5qJ/fJ/PW8jJEdIst97Gp9iYjdPLGNDliPLJRapCJBfbzQJrckNvSmLjKWS2JmA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388173; 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=q/zNEkDUIIu2pdcz+Lj4yGxhlwWPrjTc2Bm942A1PBc=; b=I/jcDcaLGY3gHVlKLnUlVK03A0xZcOpKK9pHXlHNH36AcLUDNWyxG2zAoqyBCB1r83uf vSytizrDN1x8v7+sJ34I+bwvDlkah0YNZUvjm50zsLd2Nr5W++FNd5zPL45nnsvZ93GvP EURqzhK/95JL8crxJgoGO8MY0i0Q+zAH8ARWJPdlQ77QQbOMXhvybfeyB15/cLp6Bhy6+ vhEz0Sp0lroeDErFw9OMCSaLGDxwU8bGGg5dKbJ29KkOHqjtnE5GBV+u1dFAfAyknKyIH es/i1Rv7hsCMpfUDZUbVOm+G5/dRx6MWRTBHFr6C/WFE5B8+sQHpGA/ny8AmfSWXQyQ== 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=hEl+pXxE; 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 9AA06606A32C; Fri, 4 Dec 2026 12:42:53 +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=hEl+pXxE Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7EF51F00897; Fri, 4 Dec 2026 12:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388173; bh=q/zNEkDUIIu2pdcz+Lj4yGxhlwWPrjTc2Bm942A1PBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hEl+pXxEnY9jt6iZfiWDydIrJUl007z4QYrTF31zVyLuPlMp3PrTZTPYxGATL3+n6 35kzO6e1rywvY+KxJ2kkqItrTAODUkOf7MORPyHpRcKhr+VjuPm10+ZQSkkDy3zuh5 gUMoE0slTqII69/rcW/FtNZOdibjpNkp0nvyMKks= 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.1 0512/1059] Bluetooth: L2CAP: Keep recvmsg from resuming a closed channel Date: Fri, 4 Dec 2026 19:00:43 +0900 Message-ID: <20261204100657.506038424@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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);