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 v2] netdevsim: fix rate node leak during reload and removal
Date: Mon, 23 Nov 2026 17:09:06 +0900 [thread overview]
Message-ID: <037c23b7-7b9e-4a9a-b608-552e419fcec5@linux.dev> (raw)
In-Reply-To: <20261121110858.1337003-1-xietangxin@h-partners.com>
On 2026/11/21 at 20:08 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]
> ...
>
> The rate nodes are also left behind on the devlink reload path, where
> they trigger the WARN in devlink_reload_reinit_sanity_check() instead:
>
> WARNING: net/devlink/dev.c:437 at devlink_reload_reinit_sanity_check+0x110/0x148, CPU#3: devlink/5205
> Modules linked in: netdevsim ...
> CPU: 3 UID: 0 PID: 5205 Comm: devlink Not tainted 7.4.0-rc3+ #77 PREEMPTLAZY
> Call trace:
> devlink_reload_reinit_sanity_check+0x110/0x148 (P)
> devlink_reload+0x218/0x228
> devlink_nl_reload_doit+0x3dc/0x5b4
> ...
>
> Evaluate the eswitch mode check unconditionally, so rate nodes are
> destroyed whether or not any VF was ever configured. Note this also
> resets a zero-VF switchdev device back to legacy mode on reload, like
> the existing VF case.
>
> 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
>
> Replacing the last step with "devlink dev reload netdevsim/netdevsim10"
> hits the devlink_reload_reinit_sanity_check() WARN instead.
>
> 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/
> Reported-by: Xuanqiang Luo <xuanqiang.luo@linux.dev>
> Link: https://lore.kernel.org/all/17cc4251-04ae-41a7-a872-fc5cf525b58f@linux.dev/
> Signed-off-by: xietangxin <xietangxin@h-partners.com>
> ---
Reviewed-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Thanks,
Xuanqiang
next prev parent reply other threads:[~2026-11-23 8:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 11:08 [PATCH net v2] netdevsim: fix rate node leak during reload and removal xietangxin
2026-11-23 8:09 ` Xuanqiang Luo [this message]
2026-11-25 11:22 ` netdev-bot+sashiko
2026-11-28 10:16 ` xietangxin
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=037c23b7-7b9e-4a9a-b608-552e419fcec5@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.