@@ -1802,18 +1802,24 @@ static ssize_t veth_pool_store(struct kobject *kobj, struct attribute *attr,
1802
1802
long value = simple_strtol (buf , NULL , 10 );
1803
1803
long rc ;
1804
1804
1805
+ rtnl_lock ();
1806
+
1805
1807
if (attr == & veth_active_attr ) {
1806
1808
if (value && !pool -> active ) {
1807
1809
if (netif_running (netdev )) {
1808
1810
if (ibmveth_alloc_buffer_pool (pool )) {
1809
1811
netdev_err (netdev ,
1810
1812
"unable to alloc pool\n" );
1813
+ rtnl_unlock ();
1811
1814
return - ENOMEM ;
1812
1815
}
1813
1816
pool -> active = 1 ;
1814
1817
ibmveth_close (netdev );
1815
- if ((rc = ibmveth_open (netdev )))
1818
+ rc = ibmveth_open (netdev );
1819
+ if (rc ) {
1820
+ rtnl_unlock ();
1816
1821
return rc ;
1822
+ }
1817
1823
} else {
1818
1824
pool -> active = 1 ;
1819
1825
}
@@ -1833,44 +1839,57 @@ static ssize_t veth_pool_store(struct kobject *kobj, struct attribute *attr,
1833
1839
1834
1840
if (i == IBMVETH_NUM_BUFF_POOLS ) {
1835
1841
netdev_err (netdev , "no active pool >= MTU\n" );
1842
+ rtnl_unlock ();
1836
1843
return - EPERM ;
1837
1844
}
1838
1845
1839
1846
if (netif_running (netdev )) {
1840
1847
ibmveth_close (netdev );
1841
1848
pool -> active = 0 ;
1842
- if ((rc = ibmveth_open (netdev )))
1849
+ rc = ibmveth_open (netdev );
1850
+ if (rc ) {
1851
+ rtnl_unlock ();
1843
1852
return rc ;
1853
+ }
1844
1854
}
1845
1855
pool -> active = 0 ;
1846
1856
}
1847
1857
} else if (attr == & veth_num_attr ) {
1848
1858
if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT ) {
1859
+ rtnl_unlock ();
1849
1860
return - EINVAL ;
1850
1861
} else {
1851
1862
if (netif_running (netdev )) {
1852
1863
ibmveth_close (netdev );
1853
1864
pool -> size = value ;
1854
- if ((rc = ibmveth_open (netdev )))
1865
+ rc = ibmveth_open (netdev );
1866
+ if (rc ) {
1867
+ rtnl_unlock ();
1855
1868
return rc ;
1869
+ }
1856
1870
} else {
1857
1871
pool -> size = value ;
1858
1872
}
1859
1873
}
1860
1874
} else if (attr == & veth_size_attr ) {
1861
1875
if (value <= IBMVETH_BUFF_OH || value > IBMVETH_MAX_BUF_SIZE ) {
1876
+ rtnl_unlock ();
1862
1877
return - EINVAL ;
1863
1878
} else {
1864
1879
if (netif_running (netdev )) {
1865
1880
ibmveth_close (netdev );
1866
1881
pool -> buff_size = value ;
1867
- if ((rc = ibmveth_open (netdev )))
1882
+ rc = ibmveth_open (netdev );
1883
+ if (rc ) {
1884
+ rtnl_unlock ();
1868
1885
return rc ;
1886
+ }
1869
1887
} else {
1870
1888
pool -> buff_size = value ;
1871
1889
}
1872
1890
}
1873
1891
}
1892
+ rtnl_unlock ();
1874
1893
1875
1894
/* kick the interrupt handler to allocate/deallocate pools */
1876
1895
ibmveth_interrupt (netdev -> irq , netdev );
0 commit comments