From: Xuanqiang Luo <xuanqiang.luo@linux.dev>
To: xietangxin <xietangxin@h-partners.com>
Cc: Dmytro Linkin <dlinkin@nvidia.com>,
Vlad Buslov <vladbu@nvidia.com>, Jiri Pirko <jiri@resnulli.us>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
syzbot+bbd81e1e2276c534dea1@syzkaller.appspotmail.com,
gaoxingwang1@huawei.com, huyizhen2@huawei.com,
Jakub Kicinski <kuba@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net] netdevsim: fix devlink rate node leak on devlink_free()
Date: Tue, 17 Nov 2026 19:30:49 +0900 [thread overview]
Message-ID: <17cc4251-04ae-41a7-a872-fc5cf525b58f@linux.dev> (raw)
In-Reply-To: <20261117063237.865953-1-xietangxin@h-partners.com>
On 2026/11/17 at 15:32 xietangxin wrote:
> netdevsim allows switching the eswitch mode to switchdev with zero VFs
> and creating rate nodes on such a device. However during device teardown
> nsim_dev_reload_destroy() only drops the eswitch back to legacy when VFs
> were configured, so the rate nodes are never destroyed and trigger the
> WARN_ON(devlink_rates_check()) in devlink_free():
>
> WARNING: net/devlink/core.c:544 at devlink_free+0x18c/0x26c, CPU#2: bash/5032
> Modules linked in: netdevsim ...
> CPU: 2 UID: 0 PID: 5032 Comm: bash Not tainted 7.4.0-rc3+ #77 PREEMPTLAZY
> Call trace:
> devlink_free+0x18c/0x26c (P)
> nsim_drv_remove+0x9c/0xb4 [netdevsim]
> nsim_bus_remove+0x10/0x1c [netdevsim]
> del_device_store+0x110/0x190 [netdevsim]
> ...
>
> Evaluate the eswitch mode check unconditionally, so rate nodes are
> destroyed whether or not any VF was ever configured.
>
> Reproduce by:
> $ echo "10 1" > /sys/bus/netdevsim/new_device
> $ devlink dev eswitch set netdevsim/netdevsim10 mode switchdev
> $ devlink port function rate add netdevsim/netdevsim10/n1
> $ echo 10 > /sys/bus/netdevsim/del_device
>
> Fixes: 885226f5680e ("netdevsim: Implement support for devlink rate nodes")
> Cc: stable@vger.kernel.org
> Reported-by: syzbot+bbd81e1e2276c534dea1@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/netdev/6af9824c.920b2b3a.148c65.0009.GAE@google.com/
> Signed-off-by: xietangxin <xietangxin@h-partners.com>
> ---
The rate nodes are also left behind on the reload path. I reproduced this
locally on 7.3.0 (net/main)
WARNING: net/devlink/dev.c:437 at
devlink_reload_reinit_sanity_check+0x178/0x1c8
Call trace:
devlink_reload_reinit_sanity_check+0x178/0x1c8 (P)
devlink_reload+0x298/0x2b8
devlink_nl_reload_doit+0x5cc/0x870
genl_family_rcv_msg_doit+0x15c/0x1f0
...
Please mention reload in the changelog, as it now also resets a zero-VF
switchdev device to legacy mode, like the existing VF case.
prev parent reply other threads:[~2026-11-17 10:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 6:32 xietangxin
2026-11-17 10:30 ` Xuanqiang Luo [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=17cc4251-04ae-41a7-a872-fc5cf525b58f@linux.dev \
--to=xuanqiang.luo@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dlinkin@nvidia.com \
--cc=edumazet@kernel.org \
--cc=gaoxingwang1@huawei.com \
--cc=huyizhen2@huawei.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+bbd81e1e2276c534dea1@syzkaller.appspotmail.com \
--cc=vladbu@nvidia.com \
--cc=xietangxin@h-partners.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®