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 v9 2/4] net: hsr: refuse forwarding devices as HSR/PRP ports
Date: Mon, 16 Nov 2026 16:27:25 +0000 [thread overview]
Message-ID: <179484644509.3136.13013479615245017745@kernel.org> (raw)
In-Reply-To: <20261112153333.20-3-xiexinet@gmail.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 patch is meant to stop recursive seqnr_lock acquisition from
the HSR transmit path, but it only refuses a list of device types as…
--
net: hsr: refuse forwarding devices as HSR/PRP ports
This patch stops bridge, OVS, bond and team masters from being used as
HSR/PRP slave or interlink ports. It also refuses macvlan or MACsec
devices that sit on top of such masters or on top of an HSR master. It
adds checks for a busy or unsupported RX handler and for an existing
master, and hsr_dev_finalize() now checks every port before changing any
of them.
Closes: https://syzkaller.appspot.com/bug?extid=fbf74291c3b7e753b481
> diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
> index b7765a4bb9920..666220b24dee4 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;
> + }
[Severity: High]
If a routed L2 tunnel is used as a slave, can its transmit path come back
into the same HSR master while seqnr_lock is still held?
A gretap, VXLAN or Geneve device is ARPHRD_ETHER with ETH_ALEN. It has no
rx_handler and no master. It is not a VLAN, bridge, LAG, macvlan or MACsec
device, so it passes every check in hsr_check_dev_ok().
Suppose the tunnel's remote address, or its ARP, is routed through hsr0,
for example because hsr0 has an address on the remote's subnet. Then the
announce timer alone looks like enough to trigger it:
hsr_announce()
send_hsr_supervision_frame()
spin_lock_bh(&hsr->seqnr_lock);
hsr_forward_skb()
hsr_xmit()
dev_queue_xmit(gretap0)
gre_tap_xmit()
ip_tunnel_xmit()
iptunnel_xmit()
ip_local_out()
ip_finish_output2()
dev_queue_xmit(hsr0)
hsr_dev_xmit()
spin_lock_bh(&hsr->seqnr_lock);
ip_tunnel_xmit() only rejects a route that goes back through the tunnel
device itself:
net/ipv4/ip_tunnel.c:ip_tunnel_xmit() {
...
if (rt->dst.dev == dev) {
ip_rt_put(rt);
DEV_STATS_INC(dev, collisions);
goto tx_error;
}
...
}
hsr_dev_setup() sets IFF_NO_QUEUE and lltx on hsr0, so __dev_queue_xmit()
takes the no-qdisc path. netif_tx_owned() does not see the recursion,
because xmit_lock_owner is not set for lltx devices. dev_xmit_recursion()
is also far below XMIT_RECURSION_LIMIT at this depth.
In the syzbot report the two locks belonged to two different HSR devices.
Here both belong to the same HSR device. So instead of a lockdep warning,
this looks like the CPU deadlocking on a seqnr_lock it already holds, with
BH disabled. User traffic through hsr_dev_xmit() would follow the same
path. A user with CAP_NET_ADMIN in a user namespace can create both the
HSR and the gretap links.
The commit message says this case is not handled:
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 patch has Fixes: tags for the commits that added the seqnr_lock
coverage. Would narrowing seqnr_lock be a better fix here than a list of
refused device types that will have to be replaced later anyway?
At the end of the series, after "net: hsr: segment GSO before per-frame
forwarding", hsr_forward_frame() in net/hsr/hsr_forward.c still holds the
lock around forwarding:
if (numbered)
spin_lock_bh(&hsr->seqnr_lock);
hsr_forward_skb(skb, port);
if (numbered)
spin_unlock_bh(&hsr->seqnr_lock);
Both supervision senders also still hold seqnr_lock across
hsr_forward_skb(). So this recursion still seems reachable after the full
series.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112153333.20-1-xiexinet%40gmail.com
next prev parent reply other threads:[~2026-11-16 16:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 15:33 [PATCH net v9 0/4] net: hsr: fix super-packet forwarding Xin Xie
2026-11-12 15:33 ` [PATCH net v9 1/4] net: hsr: keep GRO disabled on HSR/PRP ports Xin Xie
2026-11-16 16:27 ` netdev-bot+sashiko
2026-11-12 15:33 ` [PATCH net v9 2/4] net: hsr: refuse forwarding devices as " Xin Xie
2026-11-16 16:27 ` netdev-bot+sashiko [this message]
2026-11-12 15:33 ` [PATCH net v9 3/4] net: hsr: segment GSO before per-frame forwarding Xin Xie
2026-11-15 21:41 ` Sebastian Andrzej Siewior
2026-11-16 9:06 ` Xin Xie
2026-11-12 15:33 ` [PATCH net v9 4/4] selftests: net: hsr: verify GRO policy and ordered forwarding Xin Xie
2026-11-16 16:27 ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH net v9 0/4] net: hsr: fix super-packet forwarding Sebastian Andrzej Siewior
2026-11-15 21:45 ` Sebastian Andrzej Siewior
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=179484644509.3136.13013479615245017745@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®