net-sysfs: take the rtnl lock when storing xps_rxqs
[platform/kernel/linux-starfive.git] / net / core / net-sysfs.c
index 65886bf..62ca2f2 100644 (file)
@@ -1499,10 +1499,17 @@ static ssize_t xps_rxqs_store(struct netdev_queue *queue, const char *buf,
                return err;
        }
 
+       if (!rtnl_trylock()) {
+               bitmap_free(mask);
+               return restart_syscall();
+       }
+
        cpus_read_lock();
        err = __netif_set_xps_queue(dev, mask, index, true);
        cpus_read_unlock();
 
+       rtnl_unlock();
+
        bitmap_free(mask);
        return err ? : len;
 }