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 957543F4124; Wed, 20 May 2026 17:25:30 +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=1779297931; cv=none; b=eEsnbtBH3Ii+rSkflxvQmD1mv87TTL6BGTzHCaclzaRBZuEAlNTu+71iSElExqGss49X1VvkOLiZYiLfF/PnFszt27y2sfl1wkeAnkWdknFtCPqFQiRGVby19k1xwGwzF59TOfbli7YGlc/43JEekT+3HsYPjpu19ATIcwT0//8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779297931; c=relaxed/simple; bh=MdIUxbu31B0RO3MOHyCBkX1N42bOGRHlWkKJKBk9bSs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z5PIF5/3fzIJbEncP+LlZZnILKlgXvxgxt/xrCJdb0qMdzpVPkjHYOsVIf98KfuVpt+I++GwlyjlkghCxGx0JAlGNxq18kzCSrM8y9eH67u/SfCIo1D1xR6Q7jcogHaL95vmYd4EeHwFDTonwI3JUOz2RccqecWj3pCTtNwejnI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JtkgsrVK; 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="JtkgsrVK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 065011F000E9; Wed, 20 May 2026 17:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779297930; bh=yiCK2qKO5T/QXBgmmCFADnsJ4xp/v/is1Sll6hlNVj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JtkgsrVKU/YfdVJDGg9vfVjEOVYSwD7NCX2EIishVvBarV9Z0a8PJ+I5OsqcrjUO1 Kg6LgCKieVeW53kUWPbYRto64FxKgmW7/3D8GJ9w21ti5OalSaH3drObV5CLb2aNci ILeKBfDOtVN0V2zguhICSzNsug/SOwe9SJXl6Tow= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dudu Lu , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.18 177/957] Bluetooth: l2cap: Add missing chan lock in l2cap_ecred_reconf_rsp Date: Wed, 20 May 2026 18:11:00 +0200 Message-ID: <20260520162138.392707636@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162134.554764788@linuxfoundation.org> References: <20260520162134.554764788@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dudu Lu [ Upstream commit 42776497cdbc9a665b384a6dcb85f0d4bd927eab ] l2cap_ecred_reconf_rsp() calls l2cap_chan_del() without holding l2cap_chan_lock(). Every other l2cap_chan_del() caller in the file acquires the lock first. A remote BLE device can send a crafted L2CAP ECRED reconfiguration response to corrupt the channel list while another thread is iterating it. Add l2cap_chan_hold() and l2cap_chan_lock() before l2cap_chan_del(), and l2cap_chan_unlock() and l2cap_chan_put() after, matching the pattern used in l2cap_ecred_conn_rsp() and l2cap_conn_del(). Fixes: 15f02b910562 ("Bluetooth: L2CAP: Add initial code for Enhanced Credit Based Mode") Signed-off-by: Dudu Lu Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/l2cap_core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 7664723a34d0a..bcb13ce531099 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -5473,7 +5473,13 @@ static inline int l2cap_ecred_reconf_rsp(struct l2cap_conn *conn, if (chan->ident != cmd->ident) continue; + l2cap_chan_hold(chan); + l2cap_chan_lock(chan); + l2cap_chan_del(chan, ECONNRESET); + + l2cap_chan_unlock(chan); + l2cap_chan_put(chan); } return 0; -- 2.53.0