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 7A132199FAB; Mon, 23 Mar 2026 14:01:55 +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=1774274515; cv=none; b=INmhlHos1oZlkF/UXp7vNjRGo2tSGcaWPMp/cuEI3idwsVT/ftsGgt2l+tSx5jNzQ9hL0KqRMe4tdSONmiQEMm7VAsnZL5Y9zhd1LVqZPMyMjdmP0WwpwXQQIK73cl0kUh4Zy4F2ZE5oYgqjgo31wV1pYKKATXcJOAi9aOAv9JY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274515; c=relaxed/simple; bh=Mr1RgfhkbkwzidyQht3/WrmD1wnsScPiADdXntebQ8k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mo/p0HZuk7dcBoCDeKTteE8DGKyt+pV9UpKljucHSQh0jFAkz9gwIe5i4//CQPn+E6FMhd9P+ilmL2IYCjFH88Qq0Bu6KH5jLd+nMYSEqy2+qoBzcrkwSdkg+OrT+owAFjX0Dl6Lj92KkkNlqkP2QtxpIEf6EHNYAVGtMDF1nIk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fnEt+F7y; 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="fnEt+F7y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5537C2BC9E; Mon, 23 Mar 2026 14:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774274515; bh=Mr1RgfhkbkwzidyQht3/WrmD1wnsScPiADdXntebQ8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fnEt+F7yk16uYBPPbZm3iyhlKXBpIq16FzY73UGlpUtyYJh34tkt0qcsI9GjOxOaS bvE3Sqz8rIfcmloTUYzP2gXIUakw/LCJufkXx3Mjri7tDb1eYPbigz+eKbKcgjXnZX 45hBPc0V+wt9nNb+eKaiZGi5IXvy4bCKLZxg4MxY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Lukas=20Johannes=20M=C3=B6ller?= , Luiz Augusto von Dentz Subject: [PATCH 6.18 021/212] Bluetooth: L2CAP: Fix type confusion in l2cap_ecred_reconf_rsp() Date: Mon, 23 Mar 2026 14:44:02 +0100 Message-ID: <20260323134504.430227912@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134503.770111826@linuxfoundation.org> References: <20260323134503.770111826@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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lukas Johannes Möller commit 15145675690cab2de1056e7ed68e59cbd0452529 upstream. l2cap_ecred_reconf_rsp() casts the incoming data to struct l2cap_ecred_conn_rsp (the ECRED *connection* response, 8 bytes with result at offset 6) instead of struct l2cap_ecred_reconf_rsp (2 bytes with result at offset 0). This causes two problems: - The sizeof(*rsp) length check requires 8 bytes instead of the correct 2, so valid L2CAP_ECRED_RECONF_RSP packets are rejected with -EPROTO. - rsp->result reads from offset 6 instead of offset 0, returning wrong data when the packet is large enough to pass the check. Fix by using the correct type. Also pass the already byte-swapped result variable to BT_DBG instead of the raw __le16 field. Fixes: 15f02b910562 ("Bluetooth: L2CAP: Add initial code for Enhanced Credit Based Mode") Cc: stable@vger.kernel.org Signed-off-by: Lukas Johannes Möller Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/l2cap_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -5408,7 +5408,7 @@ static inline int l2cap_ecred_reconf_rsp u8 *data) { struct l2cap_chan *chan, *tmp; - struct l2cap_ecred_conn_rsp *rsp = (void *) data; + struct l2cap_ecred_reconf_rsp *rsp = (void *)data; u16 result; if (cmd_len < sizeof(*rsp)) @@ -5416,7 +5416,7 @@ static inline int l2cap_ecred_reconf_rsp result = __le16_to_cpu(rsp->result); - BT_DBG("result 0x%4.4x", rsp->result); + BT_DBG("result 0x%4.4x", result); if (!result) return 0;