@@ -1279,9 +1279,11 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
1279
1279
* We replay the request because the device may
1280
1280
* go away in the mean time.
1281
1281
*/
1282
+ netdev_unlock_ops (dev );
1282
1283
rtnl_unlock ();
1283
1284
request_module (NET_SCH_ALIAS_PREFIX "%s" , name );
1284
1285
rtnl_lock ();
1286
+ netdev_lock_ops (dev );
1285
1287
ops = qdisc_lookup_ops (kind );
1286
1288
if (ops != NULL ) {
1287
1289
/* We will try again qdisc_lookup_ops,
@@ -1591,7 +1593,11 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
1591
1593
if (!dev )
1592
1594
return - ENODEV ;
1593
1595
1594
- return __tc_get_qdisc (skb , n , extack , dev , tca , tcm );
1596
+ netdev_lock_ops (dev );
1597
+ err = __tc_get_qdisc (skb , n , extack , dev , tca , tcm );
1598
+ netdev_unlock_ops (dev );
1599
+
1600
+ return err ;
1595
1601
}
1596
1602
1597
1603
static bool req_create_or_replace (struct nlmsghdr * n )
@@ -1828,7 +1834,9 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
1828
1834
return - ENODEV ;
1829
1835
1830
1836
replay = false;
1837
+ netdev_lock_ops (dev );
1831
1838
err = __tc_modify_qdisc (skb , n , extack , dev , tca , tcm , & replay );
1839
+ netdev_unlock_ops (dev );
1832
1840
if (replay )
1833
1841
goto replay ;
1834
1842
@@ -1919,17 +1927,23 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
1919
1927
s_q_idx = 0 ;
1920
1928
q_idx = 0 ;
1921
1929
1930
+ netdev_lock_ops (dev );
1922
1931
if (tc_dump_qdisc_root (rtnl_dereference (dev -> qdisc ),
1923
1932
skb , cb , & q_idx , s_q_idx ,
1924
- true, tca [TCA_DUMP_INVISIBLE ]) < 0 )
1933
+ true, tca [TCA_DUMP_INVISIBLE ]) < 0 ) {
1934
+ netdev_unlock_ops (dev );
1925
1935
goto done ;
1936
+ }
1926
1937
1927
1938
dev_queue = dev_ingress_queue (dev );
1928
1939
if (dev_queue &&
1929
1940
tc_dump_qdisc_root (rtnl_dereference (dev_queue -> qdisc_sleeping ),
1930
1941
skb , cb , & q_idx , s_q_idx , false,
1931
- tca [TCA_DUMP_INVISIBLE ]) < 0 )
1942
+ tca [TCA_DUMP_INVISIBLE ]) < 0 ) {
1943
+ netdev_unlock_ops (dev );
1932
1944
goto done ;
1945
+ }
1946
+ netdev_unlock_ops (dev );
1933
1947
1934
1948
cont :
1935
1949
idx ++ ;
@@ -2308,7 +2322,11 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n,
2308
2322
if (!dev )
2309
2323
return - ENODEV ;
2310
2324
2311
- return __tc_ctl_tclass (skb , n , extack , dev , tca , tcm );
2325
+ netdev_lock_ops (dev );
2326
+ err = __tc_ctl_tclass (skb , n , extack , dev , tca , tcm );
2327
+ netdev_unlock_ops (dev );
2328
+
2329
+ return err ;
2312
2330
}
2313
2331
2314
2332
struct qdisc_dump_args {
@@ -2426,7 +2444,9 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
2426
2444
if (!dev )
2427
2445
return 0 ;
2428
2446
2447
+ netdev_lock_ops (dev );
2429
2448
err = __tc_dump_tclass (skb , cb , tcm , dev );
2449
+ netdev_unlock_ops (dev );
2430
2450
2431
2451
dev_put (dev );
2432
2452
0 commit comments