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 32F984FD26F; Wed, 30 Sep 2026 16:08:39 +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=1790784525; cv=none; b=UZsH3PQaJ/c8FgrgiuR16/sjIWfLA0Lc69/Hojirzs3pwoX3/o3MUmu9cpQxl2teuF7NHQR0c4rHUMU2eLHS7MgXfwsJlWsdbI1oaoIM8Oz1Pjq3FrbGxL4rDqXKN9vV6lxVLVUUae7bWIx+4JbymtQ/0FVvBqrK/uPlhIanHvY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790784525; c=relaxed/simple; bh=eXyEq21gyg6y9zYO51CmbFDz1Xdg/B4pvN8+iLL9DDc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T2iv88SMY+eIoyG5S8Z7FSigmdT9YOkdTJn5K2hoCHG/rGld9a83C2MuOuyBuNUFyGJKurVRhkByLqhQQcQzBtoSA34731f8S+QSJNZCW1gw889X8rChkwfpdiMk4nEif6rWk3wp2gZ5ABgWVf8wDrSTeSmUTktIwJu16L9UXGc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hHk+DbpZ; 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="hHk+DbpZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CB7C1F000FF; Wed, 30 Sep 2026 16:08:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790784516; bh=850s2vaCvHpmDonqlgFz2QP89AV7Ok4czqlLBaUpgdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hHk+DbpZZxv8dpJd4i6qM5/rL+Alg9dJeKg/FVupluP4KZDKwWluk/s3mQt5yEoXV fQrACSpyP7khPrhaTufwtCm3d9aj7rHAmmnXdtgsZuOhIR8mfh7N5cJPb+sic0iUTs QWZG260shaN5KHQ1AeSd8XFH9ckwjtwm8+1dSI5c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Samuel Moelius , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.1 184/982] Bluetooth: L2CAP: validate connectionless PSM length Date: Wed, 30 Sep 2026 17:15:20 +0200 Message-ID: <20260930152420.770864977@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152416.775402466@linuxfoundation.org> References: <20260930152416.775402466@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Samuel Moelius [ Upstream commit a40a5f922546b3bd7c094d882b29177db4f2abe0 ] Connectionless L2CAP frames carry a two-byte PSM at the start of the payload. l2cap_recv_frame() currently reads that PSM unconditionally after validating only the outer L2CAP length. A malformed connectionless frame with a zero- or one-byte payload can therefore make the parser read beyond the advertised skb payload and use tailroom bytes as part of the PSM. A VHCI-backed QEMU reproducer injected a one-byte connectionless payload and reached the unchecked read. Reject connectionless frames that cannot contain the PSM before reading or pulling it. This preserves all valid connectionless frames while dropping only structurally incomplete packets. Assisted-by: Codex:gpt-5.5-cyber-preview Signed-off-by: Samuel Moelius Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/l2cap_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 836db84816d67..3097ffd654c1e 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -7137,6 +7137,11 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb) break; case L2CAP_CID_CONN_LESS: + if (skb->len < L2CAP_PSMLEN_SIZE) { + kfree_skb(skb); + break; + } + psm = get_unaligned((__le16 *) skb->data); skb_pull(skb, L2CAP_PSMLEN_SIZE); l2cap_conless_channel(conn, psm, skb); -- 2.53.0