From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BF37633DEE6; Mon, 13 Apr 2026 17:02:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776099777; cv=none; b=ohgFIVqRsbjrwRtV/dkUDV53hM0YOpSMAkbtXnrAfpQ84ynnxs0z7DdjK4J7y2POAB39jhSGDv6I5NzFasA2dAGo2azcazitjHQogVGFkYfKeronKxu2BzFj9YDbZnRwwwsq1ctgWIGOn7vXR0Il5JJr4tN/TPFCTIs1wE4Z2hQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776099777; c=relaxed/simple; bh=pdazmLyGOAT7TyuoFSExV0EpzBXJVUusG2dw4c+5CB4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PndLabOeBa7FpmiCkbGoLmbuWyY0y+2M3XsDTGc7+KZSPxAFHeY0egsDWGon2b9x5r5tDqbQhE7nGygavpybU/FRI4bEIX5Aoi4vzxtqe81NE0FZZzrrV78azpK/czw6WWHd3IXIeVHbahlB2J2LlDm0a1/NF37iD0iGZGsR3Kg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LpEvHkng; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="LpEvHkng" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55C42C2BCAF; Mon, 13 Apr 2026 17:02:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776099777; bh=pdazmLyGOAT7TyuoFSExV0EpzBXJVUusG2dw4c+5CB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LpEvHkngeF0KDS6HSljRRmN62GoT9N7gPDfzpSwIdQxMHaAUjZD4Yh4C0bBwfFewM WDlVBCbv+h3M2DrdmPS21UmhEpOwuxU3Sms3c+s9GHwrHF3VHLpMFtLFmUEJvrgbuI ezadpL2CmQfkr2BEJ8q8NvW46WyEBmgMk7m35ssw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yiming Qian , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.10 471/491] Bluetooth: L2CAP: Fix accepting multiple L2CAP_ECRED_CONN_REQ Date: Mon, 13 Apr 2026 18:01:56 +0200 Message-ID: <20260413155836.678529287@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260413155819.042779211@linuxfoundation.org> References: <20260413155819.042779211@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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Luiz Augusto von Dentz [ Upstream commit 5b3e2052334f2ff6d5200e952f4aa66994d09899 ] Currently the code attempts to accept requests regardless of the command identifier which may cause multiple requests to be marked as pending (FLAG_DEFER_SETUP) which can cause more than L2CAP_ECRED_MAX_CID(5) to be allocated in l2cap_ecred_rsp_defer causing an overflow. The spec is quite clear that the same identifier shall not be used on subsequent requests: 'Within each signaling channel a different Identifier shall be used for each successive request or indication.' https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Core-62/out/en/host/logical-link-control-and-adaptation-protocol-specification.html#UUID-32a25a06-4aa4-c6c7-77c5-dcfe3682355d So this attempts to check if there are any channels pending with the same identifier and rejects if any are found. Fixes: 15f02b910562 ("Bluetooth: L2CAP: Add initial code for Enhanced Credit Based Mode") Reported-by: Yiming Qian Signed-off-by: Luiz Augusto von Dentz [ adapted variable names ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/l2cap_core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -6053,7 +6053,7 @@ static inline int l2cap_ecred_conn_req(s u16 mtu, mps; __le16 psm; u8 result, len = 0; - int i, num_scid; + int i, num_scid = 0; bool defer = false; if (!enable_ecred) @@ -6063,6 +6063,14 @@ static inline int l2cap_ecred_conn_req(s result = L2CAP_CR_LE_INVALID_PARAMS; goto response; } + + /* Check if there are no pending channels with the same ident */ + __l2cap_chan_list_id(conn, cmd->ident, l2cap_ecred_list_defer, + &num_scid); + if (num_scid) { + result = L2CAP_CR_LE_INVALID_PARAMS; + goto response; + } cmd_len -= sizeof(*req); num_scid = cmd_len / sizeof(u16);