From: netdev-bot+sashiko@kernel.org
To: xiexinet@gmail.com
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, andrew+netdev@lunn.ch, shuah@kernel.org,
kees@kernel.org, petr.wozniak@gmail.com, qingfang.deng@linux.dev,
fmaurer@redhat.com, luka.gejak@linux.dev, bigeasy@linutronix.de,
xiaoliang.yang_1@nxp.com, skhawaja@google.com,
liuhangbin@gmail.com, stable@vger.kernel.org,
sdf.kernel@gmail.com, lukma@denx.de, fmancera@suse.de,
danishanwar@ti.com
Subject: Re: [PATCH net v10 2/4] net: hsr: refuse forwarding devices as HSR/PRP ports
Date: Fri, 20 Nov 2026 02:22:01 +0000 [thread overview]
Message-ID: <179514132185.3136.17085396682149520983@kernel.org> (raw)
In-Reply-To: <20261117141922.20-3-xiexinet@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 1
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 patch addresses the seqnr_lock recursion only by refusing
certain port device types at attach time (bridge/OVS/bond/team…
- [Low] The patch is tagged for backport as a seqnr_lock recursion fix
(Fixes: 06afd2c31d33, from v6.2, and Fixes: 430d67bdcb04), but it also…
--
net: hsr: refuse forwarding devices as HSR/PRP ports
This patch stops bridge/OVS/bond/team masters from being used as HSR/PRP
slave or interlink ports. It also refuses a macvlan or MACsec device that
sits on top of such a master or an HSR master. This addresses the
seqnr_lock recursion that syzbot reported. The patch also refuses devices
whose RX handler is busy or unsupported, or that already have a master.
All ports are checked before any of them is modified.
Closes: https://syzkaller.appspot.com/bug?extid=fbf74291c3b7e753b481
> diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
> index 4c4f8fe3d128a..a4dd64227db5f 100644
> --- a/net/hsr/hsr_slave.c
> +++ b/net/hsr/hsr_slave.c
[ ... ]
> @@ -131,13 +163,56 @@ static int hsr_check_dev_ok(struct net_device *dev,
> return -EOPNOTSUPP;
> }
>
> - /* HSR over bonded devices has not been tested, but I'm not sure it
> - * won't work...
> + /* Forwarding devices feed HSR frames into another device's
> + * transmit path and can nest seqnr_lock through a second HSR
> + * device. A bridge, bond, team or OVS master makes no sense as a
> + * ring or LAN port and is refused by type. A macvlan or MACsec
> + * device is refused if such a master or an HSR/PRP master is
> + * below it. Other devices keep their lower devices unchecked:
> + * DSA user ports are uppers of their conduit.
> + */
> + if (netif_is_any_bridge_master(dev) || netif_is_lag_master(dev)) {
> + NL_SET_ERR_MSG_MOD(extack,
> + "Cannot use a bridge, bond, team or OVS master as HSR port.");
> + return -EINVAL;
> + }
> + if ((netif_is_macvlan(dev) || netif_is_macsec(dev)) &&
> + netdev_walk_all_lower_dev(dev, hsr_lower_forwards, NULL)) {
> + NL_SET_ERR_MSG_MOD(extack,
> + "Cannot use a macvlan or MACsec device stacked on an HSR, bridge, bond, team or OVS master as HSR port.");
> + return -EINVAL;
> + }
[Severity: High]
These checks in hsr_check_dev_ok() refuse ports by device type, and only
at attach time. seqnr_lock is still held across the synchronous transmit
to the ports:
net/hsr/hsr_device.c:hsr_dev_xmit() {
...
spin_lock_bh(&hsr->seqnr_lock);
hsr_forward_skb(skb, master);
spin_unlock_bh(&hsr->seqnr_lock);
...
}
hsr_forward_skb() then goes through hsr_xmit() to dev_queue_xmit() on the
port device. The same pattern is in send_hsr_supervision_frame(),
send_prp_supervision_frame() and the interlink branch of
hsr_handle_frame().
Can a plain veth slave still re-enter the xmit path of its own HSR master?
For example, take veth0 as a slave of hsr0, with a tc egress mirred
redirect back to hsr0:
hsr_dev_xmit(hsr0)
spin_lock_bh(&hsr->seqnr_lock)
hsr_forward_skb()
hsr_xmit()
dev_queue_xmit(veth0)
tcf_mirred_act() /* egress redirect to hsr0 */
dev_queue_xmit(hsr0)
hsr_dev_xmit(hsr0)
spin_lock_bh(&hsr->seqnr_lock) /* already held */
On the first redirect, tcf_mirred_act() only looks at
sched_mirred_dev[], and hsr0 is not in it yet. hsr0 is lltx with
IFF_NO_QUEUE, so neither the xmit_lock_owner check nor
dev_xmit_recursion() would stop this either. veth passes every check in
hsr_check_dev_ok().
That would be an AA self-deadlock on one instance with BH disabled. That
is worse than the cross-instance lockdep splat in the syzbot report.
CAP_NET_ADMIN in an unprivileged user namespace seems to be enough to set
this up.
Other ways back into an HSR master also get past these checks:
ARPHRD_ETHER tunnels routed through the HSR master, BPF redirects,
stacked devices whose lower devices are not walked (for example
virt_wifi over a bridge), and batman-adv.
The commit message acknowledges this:
Not covered are a tunnel whose route leads back through the HSR
master, a tc or BPF redirect to it, other stacked devices, and a
software device without an identifying flag such as batman-adv.
Narrowing seqnr_lock, planned for net-next, addresses that class as
a whole.
This is still the case at the end of the series. There,
hsr_forward_frame() in hsr_forward.c takes spin_lock_bh(&hsr->seqnr_lock)
around hsr_forward_skb().
The bug class covered by the Fixes: tags is still reachable. Would it be
better to stop holding seqnr_lock across dev_queue_xmit() in this fix,
instead of adding a denylist that the planned lock narrowing would
replace?
> + /* A macvlan takes its GRO setting from the lower device, so the
> + * member role cannot turn it off. Refuse at attach, before any
> + * state change, if the lower device runs GRO; it can still turn
> + * GRO on later.
> */
> + if (netif_is_macvlan(dev) &&
> + (macvlan_dev_real_dev(dev)->features & NETIF_F_GRO)) {
> + NL_SET_ERR_MSG_MOD(extack,
> + "macvlan inherits GRO from its lower device; turn GRO off on the lower device.");
> + return -EBUSY;
> + }
[Severity: Low]
This check only makes sense together with the member-role GRO policy
from the previous patch, "net: hsr: keep GRO disabled on HSR/PRP ports".
It is an earlier form of the rejection that patch added to
hsr_portdev_setup():
hsr_portdev_role_set(dev);
if (dev->features & NETIF_F_GRO) {
NL_SET_ERR_MSG_MOD(extack,
"software GRO still on after feature update, cannot join");
It is not related to the seqnr_lock recursion.
This patch carries Fixes: 06afd2c31d33 (v6.2) and Fixes: 430d67bdcb04.
The previous patch is only tagged Fixes: 5055cccfc2d1 (RedBox, v6.10).
Suppose stable takes this patch into 6.1 or 6.6 without the GRO policy
patch. Would this hunk then refuse a macvlan on a NIC or veth, where GRO
is on by default, with an error message that does not apply to that
tree?
The patch probably won't apply cleanly there anyway, since the "Member
role and feature policy" block and the interlink argument to
hsr_dev_finalize() don't exist in those trees. A backporter may drop
this hunk, but nothing in the commit tells them to.
Could this hunk move into the GRO policy patch, or could a stable
dependency note be added? Right now the commit message mentions the
previous patch only in the prose.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117141922.20-1-xiexinet%40gmail.com
next prev parent reply other threads:[~2026-11-20 2:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 14:19 [PATCH net v10 0/4] net: hsr: fix super-packet forwarding Xin Xie
2026-11-17 14:19 ` [PATCH net v10 1/4] net: hsr: keep GRO disabled on HSR/PRP ports Xin Xie
2026-11-20 2:22 ` netdev-bot+sashiko
2026-11-17 14:19 ` [PATCH net v10 2/4] net: hsr: refuse forwarding devices as " Xin Xie
2026-11-20 2:22 ` netdev-bot+sashiko [this message]
2026-11-17 14:19 ` [PATCH net v10 3/4] net: hsr: segment GSO before per-frame forwarding Xin Xie
2026-11-20 2:22 ` netdev-bot+sashiko
2026-11-17 14:19 ` [PATCH net v10 4/4] selftests: net: hsr: verify GRO policy and ordered forwarding Xin Xie
2026-11-20 2:22 ` netdev-bot+sashiko
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=179514132185.3136.17085396682149520983@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bigeasy@linutronix.de \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fmancera@suse.de \
--cc=fmaurer@redhat.com \
--cc=horms@kernel.org \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=liuhangbin@gmail.com \
--cc=luka.gejak@linux.dev \
--cc=lukma@denx.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petr.wozniak@gmail.com \
--cc=qingfang.deng@linux.dev \
--cc=sdf.kernel@gmail.com \
--cc=shuah@kernel.org \
--cc=skhawaja@google.com \
--cc=stable@vger.kernel.org \
--cc=xiaoliang.yang_1@nxp.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
all inboxes | Powered by JetHome®