Re: [PATCH net,v4, 1/3] hv_netvsc: fix race of netvsc and VF register_netdevice

From: Simon Horman
Date: Sun Nov 12 2023 - 04:45:44 EST


On Fri, Nov 10, 2023 at 06:38:58AM -0800, Haiyang Zhang wrote:
> The rtnl lock also needs to be held before rndis_filter_device_add()
> which advertises nvsp_2_vsc_capability / sriov bit, and triggers
> VF NIC offering and registering. If VF NIC finished register_netdev()
> earlier it may cause name based config failure.
>
> To fix this issue, move the call to rtnl_lock() before
> rndis_filter_device_add(), so VF will be registered later than netvsc
> / synthetic NIC, and gets a name numbered (ethX) after netvsc.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: e04e7a7bbd4b ("hv_netvsc: Fix a deadlock by getting rtnl lock earlier in netvsc_probe()")
> Reported-by: Dexuan Cui <decui@xxxxxxxxxxxxx>
> Signed-off-by: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
> Reviewed-by: Wojciech Drewek <wojciech.drewek@xxxxxxxxx>

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>