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 C9068371CEA; Wed, 20 May 2026 18:04:26 +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=1779300268; cv=none; b=Tg/2R9DRXtcaQmqpzwLcYRUGaGaxvRTr3qACnWg2TWkJtOyn3fKXIRbh0qJdygbKobSB9cRYjLHpZjRO3HoQE22gL+70DY/O26r+kIBEyPiuSeS32FgugEVA5kBSmScwBfWaJg888fhpj7W/EoUvfJUkBoPXmPPxDJbYXZ4x/PU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779300268; c=relaxed/simple; bh=S+WsLvNQWxuBWZNxISQ7B9r9yzLNDvCckNfWmTT9CA8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W+ZhcUQdtX4U7Oe2Gy49UBiu74MVRDxDiRSzzM29pwIlYqR1k2SH3yOPK2e4ZHLvouCY7GtxcUT0vHiWL6lHykiTY6Hgdz2XUXU5CgUdWAKKFj4TdSzTmslB0W3XQe+IlsXzGdHHEKbWlSKmhHs95nWMAEWQf/kmyuioe07ZJ+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=J6tTcFyw; 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="J6tTcFyw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39AC51F000E9; Wed, 20 May 2026 18:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779300266; bh=NRj6v+SSZNggE0+iVTBTykYyLs0Q/6MR+XKql07UsMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=J6tTcFywmCb0BxoOtOEOQ+DKZNCsV/j4gHiC4tS9+5FvCkLXkDo/5DJrBE1z+6DFR 14gv3JhuLjFqob19ITu4COYrfBRzYEAhB59mdBU8xoHJjSpoEUvY49/9Dt9u3tCMyL sDsX27JfnHmz5WZiAjalLbWjuKKuoNoVI9MbrIHo= 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.12 109/666] Bluetooth: l2cap: Add missing chan lock in l2cap_ecred_reconf_rsp Date: Wed, 20 May 2026 18:15:20 +0200 Message-ID: <20260520162113.583995781@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162111.222830634@linuxfoundation.org> References: <20260520162111.222830634@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: 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 bb927603c2d15..b01107370cbcb 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -5399,7 +5399,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