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/2026…%40stellman-greene.com