@@ -1267,38 +1267,8 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
1267
1267
struct qdisc_size_table * stab ;
1268
1268
1269
1269
ops = qdisc_lookup_ops (kind );
1270
- #ifdef CONFIG_MODULES
1271
- if (ops == NULL && kind != NULL ) {
1272
- char name [IFNAMSIZ ];
1273
- if (nla_strscpy (name , kind , IFNAMSIZ ) >= 0 ) {
1274
- /* We dropped the RTNL semaphore in order to
1275
- * perform the module load. So, even if we
1276
- * succeeded in loading the module we have to
1277
- * tell the caller to replay the request. We
1278
- * indicate this using -EAGAIN.
1279
- * We replay the request because the device may
1280
- * go away in the mean time.
1281
- */
1282
- netdev_unlock_ops (dev );
1283
- rtnl_unlock ();
1284
- request_module (NET_SCH_ALIAS_PREFIX "%s" , name );
1285
- rtnl_lock ();
1286
- netdev_lock_ops (dev );
1287
- ops = qdisc_lookup_ops (kind );
1288
- if (ops != NULL ) {
1289
- /* We will try again qdisc_lookup_ops,
1290
- * so don't keep a reference.
1291
- */
1292
- module_put (ops -> owner );
1293
- err = - EAGAIN ;
1294
- goto err_out ;
1295
- }
1296
- }
1297
- }
1298
- #endif
1299
-
1300
- err = - ENOENT ;
1301
1270
if (!ops ) {
1271
+ err = - ENOENT ;
1302
1272
NL_SET_ERR_MSG (extack , "Specified qdisc kind is unknown" );
1303
1273
goto err_out ;
1304
1274
}
@@ -1623,8 +1593,7 @@ static int __tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
1623
1593
struct netlink_ext_ack * extack ,
1624
1594
struct net_device * dev ,
1625
1595
struct nlattr * tca [TCA_MAX + 1 ],
1626
- struct tcmsg * tcm ,
1627
- bool * replay )
1596
+ struct tcmsg * tcm )
1628
1597
{
1629
1598
struct Qdisc * q = NULL ;
1630
1599
struct Qdisc * p = NULL ;
@@ -1789,13 +1758,8 @@ static int __tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
1789
1758
tcm -> tcm_parent , tcm -> tcm_handle ,
1790
1759
tca , & err , extack );
1791
1760
}
1792
- if (q == NULL ) {
1793
- if (err == - EAGAIN ) {
1794
- * replay = true;
1795
- return 0 ;
1796
- }
1761
+ if (!q )
1797
1762
return err ;
1798
- }
1799
1763
1800
1764
graft :
1801
1765
err = qdisc_graft (dev , p , skb , n , clid , q , NULL , extack );
@@ -1808,6 +1772,27 @@ static int __tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
1808
1772
return 0 ;
1809
1773
}
1810
1774
1775
+ static void request_qdisc_module (struct nlattr * kind )
1776
+ {
1777
+ struct Qdisc_ops * ops ;
1778
+ char name [IFNAMSIZ ];
1779
+
1780
+ if (!kind )
1781
+ return ;
1782
+
1783
+ ops = qdisc_lookup_ops (kind );
1784
+ if (ops ) {
1785
+ module_put (ops -> owner );
1786
+ return ;
1787
+ }
1788
+
1789
+ if (nla_strscpy (name , kind , IFNAMSIZ ) >= 0 ) {
1790
+ rtnl_unlock ();
1791
+ request_module (NET_SCH_ALIAS_PREFIX "%s" , name );
1792
+ rtnl_lock ();
1793
+ }
1794
+ }
1795
+
1811
1796
/*
1812
1797
* Create/change qdisc.
1813
1798
*/
@@ -1818,27 +1803,23 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
1818
1803
struct nlattr * tca [TCA_MAX + 1 ];
1819
1804
struct net_device * dev ;
1820
1805
struct tcmsg * tcm ;
1821
- bool replay ;
1822
1806
int err ;
1823
1807
1824
- replay :
1825
- /* Reinit, just in case something touches this. */
1826
1808
err = nlmsg_parse_deprecated (n , sizeof (* tcm ), tca , TCA_MAX ,
1827
1809
rtm_tca_policy , extack );
1828
1810
if (err < 0 )
1829
1811
return err ;
1830
1812
1813
+ request_qdisc_module (tca [TCA_KIND ]);
1814
+
1831
1815
tcm = nlmsg_data (n );
1832
1816
dev = __dev_get_by_index (net , tcm -> tcm_ifindex );
1833
1817
if (!dev )
1834
1818
return - ENODEV ;
1835
1819
1836
- replay = false;
1837
1820
netdev_lock_ops (dev );
1838
- err = __tc_modify_qdisc (skb , n , extack , dev , tca , tcm , & replay );
1821
+ err = __tc_modify_qdisc (skb , n , extack , dev , tca , tcm );
1839
1822
netdev_unlock_ops (dev );
1840
- if (replay )
1841
- goto replay ;
1842
1823
1843
1824
return err ;
1844
1825
}
0 commit comments