Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: bugs@stellman-greene.com
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
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	[thread overview]
Message-ID: <179631738292.3146.356916563895231141@kernel.org> (raw)
In-Reply-To: <20261202165002.49988-1-bugs@stellman-greene.com>

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

      parent reply	other threads:[~2026-12-03 17:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 16:50 [PATCH net] net: hsr: don't take the PRP RCT from host frame payloads Andrew Stellman
2026-12-03 16:00 ` Daniel Machon
2026-12-03 17:03 ` netdev-bot+sashiko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179631738292.3146.356916563895231141@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=bugs@stellman-greene.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=fmancera@suse.de \
    --cc=fmaurer@redhat.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=luka.gejak@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ssrane_b23@ee.vjti.ac.in \
    --cc=willemb@google.com \
    --cc=xiexinet@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox