netif_set_xps_queue must be called with the rtnl lock taken, and this is now enforced using ASSERT_RTNL(). In virtio_net, netif_set_xps_queue is called by virtnet_set_affinity. As this function can be called from an ethtool helper, we can't take the rtnl lock directly in it. Instead we take the rtnl lock when calling virtnet_set_affinity when the rtnl lock isn't taken already.
Signed-off-by: Antoine Tenart <aten...@kernel.org> --- drivers/net/virtio_net.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index dde9bbcc5ff0..54d2277f6c98 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2027,7 +2027,9 @@ static int virtnet_cpu_online(unsigned int cpu, struct hlist_node *node) { struct virtnet_info *vi = hlist_entry_safe(node, struct virtnet_info, node); + rtnl_lock(); virtnet_set_affinity(vi); + rtnl_unlock(); return 0; } @@ -2035,7 +2037,9 @@ static int virtnet_cpu_dead(unsigned int cpu, struct hlist_node *node) { struct virtnet_info *vi = hlist_entry_safe(node, struct virtnet_info, node_dead); + rtnl_lock(); virtnet_set_affinity(vi); + rtnl_unlock(); return 0; } @@ -2883,7 +2887,9 @@ static int init_vqs(struct virtnet_info *vi) goto err_free; get_online_cpus(); + rtnl_lock(); virtnet_set_affinity(vi); + rtnl_unlock(); put_online_cpus(); return 0; -- 2.29.2