From mboxrd@z Thu Jan 1 00:00:00 1970 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 0F7E04E4C24; Thu, 17 Sep 2026 15:30:19 +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=1789659029; cv=none; b=i8XfDv2Y8k4qwXxFpQ45w007YOofATx59QLnSjJdk+aKp9wmgNsC3DQVLSSFVTuN6j0GvRToC3aUCZsqWoRw68cqXmLQtJKAd6ugFhZRc5LUeZN8U2aYXdBbqZkirfwgeUkXlorlel77/hmgtwFf5+U3XCITFGJmc6D2x9HD54U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789659029; c=relaxed/simple; bh=4/vfpl34ciC08Za+Gjtk2a89VSMHqGY4kAYT5CmMzQQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h3PCY+mPlDmd31pVwaCQN3xB7tpKajb99+4f6UnBN2vwW+Ywu1naYfAApGFPQy6n7dpLn6VMx/qdFsoWtMVQbp0TIiozcfrqfO6ZJhaWs4oSbkh9Ou4NnVWLy1mPRk22NUywsWi/CaLNqMQYc8vcfneGXj54GKNtnNixaWD3SPM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pppYaX5v; 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="pppYaX5v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08D3B1F000FF; Thu, 17 Sep 2026 15:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789659016; bh=SLDs/mYvwdBqvdE79/UTixxZkp7lSvJtAxnp2CVTtpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pppYaX5vSgCMGJZ3djlkbvIGY6cSd4ZIHDZ0SdLFsZ5V0mSdyzbcnTQBmZDwMULU2 STS5StLfOFN2OWG7FXNoS0kKPgUd9AmSCfkaMAIYWHCaPYa9qH/0q5aAzyco14hqT7 r+gYHf3NzbLtEAtyoksVGnQ5nu6XcLBQVLwr8yM8= 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 7.2 114/733] Bluetooth: L2CAP: clear FLAG_DEFER_SETUP only for same PID/PSM Date: Thu, 17 Sep 2026 16:07:02 +0100 Message-ID: <20260917151353.830429455@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151350.597953846@linuxfoundation.org> References: <20260917151350.597953846@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 7.2-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 b31afc4d7dae2..800f7517bfeb0 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -1352,7 +1352,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); @@ -1362,6 +1362,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