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 8A5BE4204E; Sun, 7 Jun 2026 10:10:12 +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=1780827013; cv=none; b=qFoHVPv8cSzFDQ/uFP1JrQN3VjEkKat2ERqYqYMcNRq+ENNC+4cCfftKnr8edoq+rMCJJvmyNWTpsNXKEnytpkZNYvJYxnDgk3X4PpYJ9aYrZ5A2y1rytd7TvnGlUO3Xw/Jzd8zAmE/gW3oLQc7MrWZpvyDdgd7fUsuNFiL58qE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780827013; c=relaxed/simple; bh=Y9lgUfFcYfhOdsPv9X7Ccz1LIQykL64UeMd4Itq5aUw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HKIw1VxBzlhld1vPbB9IANGV5qQ5uXE2wYZA+itRhrdx5+EiPwhPxAGytGcS4zJRgRooS9dq8eEMTXcUroNsj41P3XdoPC7VyIuRZ9uNsyRqeX2DeFwJHiDoZqLETI6vlFJMLIOOOLU9b8mVyPmLP8XvIewhIkx1uA4N4+PXYeo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=166ttxUS; 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="166ttxUS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FB171F00893; Sun, 7 Jun 2026 10:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780827012; bh=ohGih8nhtqNA6ik+Q5cl5DkHSaqcXGCQjnB+z9VeUCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=166ttxUSowU3KCZG8xdCPBTMWU5d8mX64rkaRjcj4uUjaV+/W1Jo1C2F62+q+0BVh OOvfxQKJFqrfd9uqgcHBYYcvFQGkzW1/4tObhfLtVxVbyUBIYQEmNqNaW1nTvFSiOj LAp27/HBvXAUViB88TlU8UrA64M3evAhv0DjMv/8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Luka Gejak , Fernando Fernandez Mancera , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 032/315] net: hsr: fix potential OOB access in supervision frame handling Date: Sun, 7 Jun 2026 11:56:59 +0200 Message-ID: <20260607095728.701541087@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095727.528828913@linuxfoundation.org> References: <20260607095727.528828913@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Luka Gejak [ Upstream commit f229426072fc865654a60978bb7fda790a051ff3 ] Ensure the entire TLV header is linearized before access by adding sizeof(struct hsr_sup_tlv) to the pskb_may_pull() calls. Without this, a truncated frame could cause an out-of-bounds access. Fixes: eafaa88b3eb7 ("net: hsr: Add support for redbox supervision frames") Signed-off-by: Luka Gejak Reviewed-by: Fernando Fernandez Mancera Link: https://patch.msgid.link/20260523130330.61880-1-luka.gejak@linux.dev Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/hsr/hsr_forward.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c index aefc9b6936ba0c..299de290ddaa5c 100644 --- a/net/hsr/hsr_forward.c +++ b/net/hsr/hsr_forward.c @@ -84,7 +84,7 @@ static bool is_supervision_frame(struct hsr_priv *hsr, struct sk_buff *skb) /* Get next tlv */ total_length += hsr_sup_tag->tlv.HSR_TLV_length; - if (!pskb_may_pull(skb, total_length)) + if (!pskb_may_pull(skb, total_length + sizeof(struct hsr_sup_tlv))) return false; skb_pull(skb, total_length); hsr_sup_tlv = (struct hsr_sup_tlv *)skb->data; @@ -100,7 +100,7 @@ static bool is_supervision_frame(struct hsr_priv *hsr, struct sk_buff *skb) /* make sure another tlv follows */ total_length += sizeof(struct hsr_sup_tlv) + hsr_sup_tlv->HSR_TLV_length; - if (!pskb_may_pull(skb, total_length)) + if (!pskb_may_pull(skb, total_length + sizeof(struct hsr_sup_tlv))) return false; /* get next tlv */ -- 2.53.0