Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 44D8F484894; Thu, 17 Sep 2026 18:14:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789668884; cv=none; b=SywU8YO8Wt8O8VL8eUAVrtYYvhU2rqVfu5m41qVeuXHSxJObUKv2YpgqNXv6FD8v7S/nSxPpxr/GumBG96XEy2ATn1jag+lMfgWbNV2eYHPYA1xvGWdl/S10QL7jxNfg/tWSN3aOmmybRH0t9UINt3oNVGj1RYa6oo0yXbUzLks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789668884; c=relaxed/simple; bh=8lj/1of5KdpLBsWSqYYMi16aXZldFXc2p1J56wlqJLc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mf/TiUbD4x+hVXFu7eT6d9gnGXk76S6QNue1myk32SKKnJ3XrLAIC7gTxCNLNB4aS2w7OwIlY+uvKKaROdKnEa4HvXns7dcjNwNF+vC22h8U5bGjZhEUQ4CnmyjXTCG9VLZedqvIfQ8J8xyHZVhD4hNMtoW8kA/K68g4iqB+2qs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=S0qbJQ/V; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="S0qbJQ/V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DC1D1F000FF; Thu, 17 Sep 2026 18:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789668883; bh=gJQ77GQVVIcEiwo3BvJjhVOTOQioHhI+PX3tWDuinYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=S0qbJQ/VH44ExhRMHeTQmvqWZ8VVLYyRHaQ4XOihwV6KFVSxCxGBLRYfnrEEVZ26a lCQV5PYypB2xGhct0ncBzVYFC2E3mMHT7AGzVGgYkIT38BHWMnq5GoqeORsQiEgUg7 ZV/2I52lxNaVBipF/tPiXaZ0npbJbpjykMjDDZWQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pauli Virtanen , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.12 0555/1102] Bluetooth: L2CAP: clear FLAG_DEFER_SETUP only for same PID/PSM Date: Thu, 17 Sep 2026 16:08:18 +0100 Message-ID: <20260917151553.782783285@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151539.408551884@linuxfoundation.org> References: <20260917151539.408551884@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pauli Virtanen [ Upstream commit 0d77683237270702fa93489ca759c89b4e970554 ] l2cap_ecred_defer_connect() clears FLAG_DEFER_SETUP also for channels with different PID/PSM, which will not be added to the same ECRED_CONN_REQ in any case. Consequently, only one ECRED connection group can work at a time although it appears intended they would be separate for each PID/PSM combination. Fix by clearing FLAG_DEFER_SETUP only for the connections that could be added in the request. Retain test_bit(FLAG_DEFER_SETUP) before calling get_peer_pid as it may be NULL otherwise. Fixes: da49b602f7f7 ("Bluetooth: L2CAP: Use DEFER_SETUP to group ECRED connections") Signed-off-by: Pauli Virtanen Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/l2cap_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 9991afc177426..158719cc9e942 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -1355,7 +1355,7 @@ static void l2cap_ecred_defer_connect(struct l2cap_chan *chan, void *data) if (chan == conn->chan) return; - if (!test_and_clear_bit(FLAG_DEFER_SETUP, &chan->flags)) + if (!test_bit(FLAG_DEFER_SETUP, &chan->flags)) return; pid = chan->ops->get_peer_pid(chan); @@ -1365,6 +1365,9 @@ static void l2cap_ecred_defer_connect(struct l2cap_chan *chan, void *data) chan->mode != L2CAP_MODE_EXT_FLOWCTL || chan->state != BT_CONNECT) return; + if (!test_and_clear_bit(FLAG_DEFER_SETUP, &chan->flags)) + return; + if (test_and_set_bit(FLAG_ECRED_CONN_REQ_SENT, &chan->flags)) return; -- 2.53.0