🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Xuanqiang Luo Tue, 17 Nov 2026 10:30
Re: [PATCH net] netdevsim: fix devlink rate node leak on devlink_free()
#17786
Author: Xuanqiang Luo
Date: Tue, 17 Nov 2026 10:30
48 lines
10601 bytes
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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads