๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26514

Re: [PATCH net] net: hsr: don't take the PRP RCT from host frame payloads

#26514
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 17:03
115 lines
12123 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 1 ยท Medium: 0 ยท Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] The fix is incomplete.

--

net: hsr: don't take the PRP RCT from host frame payloads

prp_fill_frame_info() checks the end of every frame for a Redundancy
Control Trailer, including frames sent through the PRP master. This patch
skips that check for frames received on the master port, so a payload
that happens to end in RCT-like bytes is no longer treated as an RCT.

> diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c
> index 44f6d9c83180a..6cec0d36e9e84 100644
> --- a/net/hsr/hsr_forward.c
> +++ b/net/hsr/hsr_forward.c
> @@ -682,7 +682,8 @@ int prp_fill_frame_info(__be16 proto, struct sk_buff *skb,
>  	/* Supervision frame */
>  	struct prp_rct *rct = skb_get_PRP_rct(skb);
>  
> -	if (rct &&
> +	/* Host frames have no RCT yet, even if their payload looks like one. */
> +	if (rct && frame->port_rcv->type != HSR_PT_MASTER &&
>  	    prp_check_lsdu_size(skb, rct, frame->is_supervision)) {
>  		frame->skb_hsr = NULL;
>  		frame->skb_std = NULL;

[Severity: High]
Should HSR_PT_INTERLINK also be excluded here?

In PRP RedBox mode, frames arriving on the interlink come from SANs. Like
host frames, they have no RCT yet. They still go through this check, though.

handle_std_frame() already treats master and interlink the same way, as
ports whose frames get the local sequence number:

net/hsr/hsr_forward.c:handle_std_frame() {
    ...
	if (port->type == HSR_PT_MASTER ||
	    port->type == HSR_PT_INTERLINK) {
		/* Sequence nr for the master/interlink node */
		lockdep_assert_held(&hsr->seqnr_lock);
		frame->sequence_nr = hsr->sequence_nr;
		WRITE_ONCE(hsr->sequence_nr, hsr->sequence_nr + 1);
	}
}

hsr_handle_frame() also takes seqnr_lock around hsr_forward_skb() only for
interlink frames, because those frames are supposed to get a locally
assigned sequence number.

Suppose a SAN on the interlink sends a frame whose last 6 bytes end in
0x88FB, with the LSDU size field equal to skb->len - 14 (or skb->len - 18
with a VLAN tag). That frame takes the skb_prp path:

hsr_handle_frame()
  hsr_forward_skb()
    fill_frame_info()
      prp_fill_frame_info()
        frame->skb_prp = skb;
        frame->sequence_nr = prp_get_skb_sequence_nr(rct);

The result is the same failure this patch fixes for the master port:

- frame->sequence_nr comes from the SAN's payload.
- hsr->sequence_nr is not advanced.
- handle_std_frame() is skipped, so is_from_san stays false.

prp_create_tagged_frame() then writes the LAN ID into the payload bytes in
place before cloning:

	if (frame->skb_prp) {
		struct prp_rct *trailer = skb_get_PRP_rct(frame->skb_prp);

		if (trailer) {
			prp_set_lan_id(trailer, port);
		...
		return skb_clone(frame->skb_prp, GFP_ATOMIC);

So the frame goes out on LAN A/B with a changed payload and no real RCT.
On local delivery, prp_get_untagged_frame() also trims the last 6 payload
bytes.

The new comment ("Host frames have no RCT yet, even if their payload looks
like one") seems to apply just as well to SAN frames bridged from the
interlink. Would a check like the following cover both cases?

	frame->port_rcv->type != HSR_PT_MASTER &&
	frame->port_rcv->type != HSR_PT_INTERLINK

The commit message also doesn't say why the interlink is left out.

hsr_get_node() in net/hsr/hsr_framereg.c uses the same master-only rule.
An interlink SAN whose payload looks like an RCT therefore gets recorded
with san == false:

		rct = skb_get_PRP_rct(skb);
		if (!rct && rx_port != HSR_PT_MASTER)
			san = true;

Should that be updated together with this check?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202165002.49988-1-bugs%40stellman-greene.com
Technical Details
Message-ID: <179631738292.3146.356916563895231141@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376774-linux-kernel-netdev=dewy.ru
References: <20261202165002.49988-1-bugs@stellman-greene.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376774-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net: hsr: don't take the PRP RCT from host frame payloads
Date: Thu, 03 Dec 2026 17:03:02 +0000
Organization: Usenet Network
Message-ID: <179631738292.3146.356916563895231141@kernel.org>
References: <20261202165002.49988-1-bugs@stellman-greene.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2548970"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:zzXdTqFkD7KQovYz5J6nQ9TFAK4= sha256:5scbv+6BOO9zNpcbRFGulmPlYb1XCWuQz2uvWGOtr1Y=
	sha1:A7UVQFb7oULlt+HuliBw2z0VwPs= sha256:mtwK+dyfSyZLH0GfGRCffeBc6ryay3L5iYIlSgFgsJw=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 717931179E2; Thu,  3 Dec 2026 20:03:22 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.64
X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id Iia3HRilTTP1;
	Thu,  3 Dec 2026 20:03:19 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376774-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 470261179D5; Thu,  3 Dec 2026 20:03:11 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 93AB42D5CD; Thu,  3 Dec 2026 17:03:05 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796317385;
	b=oZVXQDWCVsGSgjNP6Yv06ky20zulwddeHfrQ6wCeGOks69I/cWslGkMMoMwJ7/mKbsrZ
	 5u5E/u8oYSIY32fz/hCMy4eOblETg3m3KddLHMLUrJyovbUO5dXS0uQC3a8kIOzBwHsIX
	 KetlEy11SG/fAOywebqkuyvtJvuOi0GaohIGeYTc2Gci74sHDgL3T1iUuCnuvs9bgafHP
	 hWylP8vFNFYCHt7j2hd7xOdSy7K0QiOdJrFZ4JPFx6Z2Lq3UetFqo4dNusKXqF2hRl1W7
	 4k0yn9Rx5HQJQExYwlZaptA1pWyejRJrBg2Ukbqz59P0otvcvPUwJjOkvei6GCo3fZA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796317385;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=fNJeRWzi0Z6A142pK95m9+ue1eIBc+YFpsJrcAUAT6Y=;
	b=E5Y5+a2KL5fBJdCp2oFSqRgcsAOmmSPEyr9ectdG3GLPnKbeVEUyJ+Jc6VI02u5S06Er
	 ETiasSIVIYnTzK2wwfTYFhNVuhx76xntOifu4mzP7GhNY+rDBg61FNUP9EzIjMcAniPJm
	 0NRKGXqBVlvimMFFd6Hs7gyulHCzyBFfxxEt5sJIf3u26TCibN5pa/MVvlUw922oWggYy
	 S7z2k7ClUBcPawiSYhvU7J80Zy1Lub8prrjNx8Ryfb3XqBLCPN+wA8ZG9XBBFb7FvpKlo
	 8QVzmDOJTcXmpfQAMNJwE0HSxmW3duk119uj+btDYjgQlaIxTO3yOCslLysCJdkFfIQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=f++ljWEb;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C04C606A334;
	Thu,  3 Dec 2026 17:03:05 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=f++ljWEb
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796317384;
	b=SXN/cPZb2zQpedy4KZ5TPH2NnaCCW+9CLY9fzC1agE+WVkbWHIg5aG93ETny4fOwpOvo
	 N5W0dhi+gBjOzpTSCYTuB33DT5U4yJTpPkGrNDywgyuEMEdoyiO2qdN5+VgvitSaMp2SV
	 mvwypjTPLVTphE9lkwu/+D0T2I6yh7C4wRO3DkySBSQqjNaOcfsBWS0MXWYA7d3u3kBuv
	 iA1UmuAsBaIMkJp23VrhETeVKyLs1hkdLozRq7h6kpRiR+Upe9t/6PDQPmhJw/oy0ZXe/
	 1/bPlh3VJONai3+Wzx0i5yQCq+5hk977wZ7Lu+6srHAJKmGPYKOerMnPJGHXK5cmAAQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796317384;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=fNJeRWzi0Z6A142pK95m9+ue1eIBc+YFpsJrcAUAT6Y=;
	b=JeVb9IecPUB6VN1R7LSkriaHCusHpGg4gkbtvRjkSlkNK8SJ/DRxNeUEhw8i23Slz1fW
	 e04NRL0oGiwUCHkBIU3atUmOj49oX2bzGE0lQq/tt/cTOYzKYuizFaDOoD7/TfE8zPO5M
	 oMoeBmcqA/sQqD+iEMGyz3bHbEbtYBYDLPY9ekO5QjUpmC7j6P+BRQUeuZ+tqx1Xn3x1H
	 gxwcgPyTepn5g+m8+8vzmnK1P+LLpJizdkedUwKyTpBdGiWFhkGf2Ga/8ywqyiFufCGBT
	 EpxrlYjlN66lGjeFb69OOkFJWuLGl0lMW1spwHC73TmQg3HjlSxLsr53W62HQnqvT6Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=f++ljWEb;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A343606A333
	for <netdev@vger.kernel.org>; Thu,  3 Dec 2026 17:03:04 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56C361F00926;
	Thu,  3 Dec 2026 17:03:03 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796317384;
	bh=fNJeRWzi0Z6A142pK95m9+ue1eIBc+YFpsJrcAUAT6Y=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=f++ljWEbU98zBHZGluCV5onm61xQbw+aUpuYG4H9IhZfI3O1sqyDNljAHLdHC18OV
	 bhWKXwPKWzEu9il2PhrBp62RzJ4kqNEri2xlYO8NKa5TdKtpYwWN9FamP5Hk+Gs+QE
	 EzXNsIQneNLRsz3vYFA7GMrjSjeBH5lYYjUq/utArWxr0p7dfMAdszLgb5yOPxlmBO
	 nRIimpgSu0jpVkQoHGCflTQyJYjizPNLXf0lfDf7MJwsvzVYbN5dWj6k6KywCRZh0h
	 dFZ7M4U5Tx6cKoIKVDQgOk+mhusbLulbTkEqdwyTNu3+s7+bZPOhlwB4rXY6nib8yV
	 Vn8ak3OOeThZQ==
X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
 pabeni@redhat.com, horms@kernel.org, willemb@google.com, fmaurer@redhat.com,
 luka.gejak@linux.dev, fmancera@suse.de, ssrane_b23@ee.vjti.ac.in,
 xiexinet@gmail.com, netdev@vger.kernel.org
X-In-Reply-To: <20261202165002.49988-1-bugs@stellman-greene.com>
X-sashiko-severity: High
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list