aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r--drivers/net/bonding/bond_sysfs.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index ea7a388f4843..d7434e0a610e 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -316,6 +316,9 @@ static ssize_t bonding_store_mode(struct device *d,
316 int new_value, ret = count; 316 int new_value, ret = count;
317 struct bonding *bond = to_bond(d); 317 struct bonding *bond = to_bond(d);
318 318
319 if (!rtnl_trylock())
320 return restart_syscall();
321
319 if (bond->dev->flags & IFF_UP) { 322 if (bond->dev->flags & IFF_UP) {
320 pr_err("unable to update mode of %s because interface is up.\n", 323 pr_err("unable to update mode of %s because interface is up.\n",
321 bond->dev->name); 324 bond->dev->name);
@@ -352,6 +355,7 @@ static ssize_t bonding_store_mode(struct device *d,
352 bond->dev->name, bond_mode_tbl[new_value].modename, 355 bond->dev->name, bond_mode_tbl[new_value].modename,
353 new_value); 356 new_value);
354out: 357out:
358 rtnl_unlock();
355 return ret; 359 return ret;
356} 360}
357static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, 361static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR,
@@ -1315,7 +1319,6 @@ static ssize_t bonding_show_mii_status(struct device *d,
1315} 1319}
1316static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL); 1320static DEVICE_ATTR(mii_status, S_IRUGO, bonding_show_mii_status, NULL);
1317 1321
1318
1319/* 1322/*
1320 * Show current 802.3ad aggregator ID. 1323 * Show current 802.3ad aggregator ID.
1321 */ 1324 */
@@ -1329,7 +1332,7 @@ static ssize_t bonding_show_ad_aggregator(struct device *d,
1329 if (bond->params.mode == BOND_MODE_8023AD) { 1332 if (bond->params.mode == BOND_MODE_8023AD) {
1330 struct ad_info ad_info; 1333 struct ad_info ad_info;
1331 count = sprintf(buf, "%d\n", 1334 count = sprintf(buf, "%d\n",
1332 (bond_3ad_get_active_agg_info(bond, &ad_info)) 1335 bond_3ad_get_active_agg_info(bond, &ad_info)
1333 ? 0 : ad_info.aggregator_id); 1336 ? 0 : ad_info.aggregator_id);
1334 } 1337 }
1335 1338
@@ -1351,7 +1354,7 @@ static ssize_t bonding_show_ad_num_ports(struct device *d,
1351 if (bond->params.mode == BOND_MODE_8023AD) { 1354 if (bond->params.mode == BOND_MODE_8023AD) {
1352 struct ad_info ad_info; 1355 struct ad_info ad_info;
1353 count = sprintf(buf, "%d\n", 1356 count = sprintf(buf, "%d\n",
1354 (bond_3ad_get_active_agg_info(bond, &ad_info)) 1357 bond_3ad_get_active_agg_info(bond, &ad_info)
1355 ? 0 : ad_info.ports); 1358 ? 0 : ad_info.ports);
1356 } 1359 }
1357 1360
@@ -1373,7 +1376,7 @@ static ssize_t bonding_show_ad_actor_key(struct device *d,
1373 if (bond->params.mode == BOND_MODE_8023AD) { 1376 if (bond->params.mode == BOND_MODE_8023AD) {
1374 struct ad_info ad_info; 1377 struct ad_info ad_info;
1375 count = sprintf(buf, "%d\n", 1378 count = sprintf(buf, "%d\n",
1376 (bond_3ad_get_active_agg_info(bond, &ad_info)) 1379 bond_3ad_get_active_agg_info(bond, &ad_info)
1377 ? 0 : ad_info.actor_key); 1380 ? 0 : ad_info.actor_key);
1378 } 1381 }
1379 1382
@@ -1395,7 +1398,7 @@ static ssize_t bonding_show_ad_partner_key(struct device *d,
1395 if (bond->params.mode == BOND_MODE_8023AD) { 1398 if (bond->params.mode == BOND_MODE_8023AD) {
1396 struct ad_info ad_info; 1399 struct ad_info ad_info;
1397 count = sprintf(buf, "%d\n", 1400 count = sprintf(buf, "%d\n",
1398 (bond_3ad_get_active_agg_info(bond, &ad_info)) 1401 bond_3ad_get_active_agg_info(bond, &ad_info)
1399 ? 0 : ad_info.partner_key); 1402 ? 0 : ad_info.partner_key);
1400 } 1403 }
1401 1404