aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-04-02 04:51:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-09 15:54:46 -0400
commit2b5f8b0b44e17e625cfba1e7b88db44f4dcc0441 (patch)
treefc33627d2022e848b881e88494a8e7dbab7643a4 /net
parent3f9768a5d262d01d317b2a03933db3d5082fcb68 (diff)
nl80211: ensure interface is up in various APIs
The nl80211 handling code should ensure as much as it can that the interface is in a valid state, it can certainly ensure the interface is running. Not doing so can cause calls through mac80211 into the driver that result in warnings and unspecified behaviour in the driver. Cc: stable@vger.kernel.org Reported-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/wireless/nl80211.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e49da2797022..f432c57af05d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1294,6 +1294,11 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
1294 goto bad_res; 1294 goto bad_res;
1295 } 1295 }
1296 1296
1297 if (!netif_running(netdev)) {
1298 result = -ENETDOWN;
1299 goto bad_res;
1300 }
1301
1297 nla_for_each_nested(nl_txq_params, 1302 nla_for_each_nested(nl_txq_params,
1298 info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], 1303 info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS],
1299 rem_txq_params) { 1304 rem_txq_params) {
@@ -6384,7 +6389,7 @@ static struct genl_ops nl80211_ops[] = {
6384 .doit = nl80211_get_key, 6389 .doit = nl80211_get_key,
6385 .policy = nl80211_policy, 6390 .policy = nl80211_policy,
6386 .flags = GENL_ADMIN_PERM, 6391 .flags = GENL_ADMIN_PERM,
6387 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6392 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6388 NL80211_FLAG_NEED_RTNL, 6393 NL80211_FLAG_NEED_RTNL,
6389 }, 6394 },
6390 { 6395 {
@@ -6416,7 +6421,7 @@ static struct genl_ops nl80211_ops[] = {
6416 .policy = nl80211_policy, 6421 .policy = nl80211_policy,
6417 .flags = GENL_ADMIN_PERM, 6422 .flags = GENL_ADMIN_PERM,
6418 .doit = nl80211_set_beacon, 6423 .doit = nl80211_set_beacon,
6419 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6424 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6420 NL80211_FLAG_NEED_RTNL, 6425 NL80211_FLAG_NEED_RTNL,
6421 }, 6426 },
6422 { 6427 {
@@ -6424,7 +6429,7 @@ static struct genl_ops nl80211_ops[] = {
6424 .policy = nl80211_policy, 6429 .policy = nl80211_policy,
6425 .flags = GENL_ADMIN_PERM, 6430 .flags = GENL_ADMIN_PERM,
6426 .doit = nl80211_start_ap, 6431 .doit = nl80211_start_ap,
6427 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6432 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6428 NL80211_FLAG_NEED_RTNL, 6433 NL80211_FLAG_NEED_RTNL,
6429 }, 6434 },
6430 { 6435 {
@@ -6432,7 +6437,7 @@ static struct genl_ops nl80211_ops[] = {
6432 .policy = nl80211_policy, 6437 .policy = nl80211_policy,
6433 .flags = GENL_ADMIN_PERM, 6438 .flags = GENL_ADMIN_PERM,
6434 .doit = nl80211_stop_ap, 6439 .doit = nl80211_stop_ap,
6435 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6440 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6436 NL80211_FLAG_NEED_RTNL, 6441 NL80211_FLAG_NEED_RTNL,
6437 }, 6442 },
6438 { 6443 {
@@ -6448,7 +6453,7 @@ static struct genl_ops nl80211_ops[] = {
6448 .doit = nl80211_set_station, 6453 .doit = nl80211_set_station,
6449 .policy = nl80211_policy, 6454 .policy = nl80211_policy,
6450 .flags = GENL_ADMIN_PERM, 6455 .flags = GENL_ADMIN_PERM,
6451 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6456 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6452 NL80211_FLAG_NEED_RTNL, 6457 NL80211_FLAG_NEED_RTNL,
6453 }, 6458 },
6454 { 6459 {
@@ -6464,7 +6469,7 @@ static struct genl_ops nl80211_ops[] = {
6464 .doit = nl80211_del_station, 6469 .doit = nl80211_del_station,
6465 .policy = nl80211_policy, 6470 .policy = nl80211_policy,
6466 .flags = GENL_ADMIN_PERM, 6471 .flags = GENL_ADMIN_PERM,
6467 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6472 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6468 NL80211_FLAG_NEED_RTNL, 6473 NL80211_FLAG_NEED_RTNL,
6469 }, 6474 },
6470 { 6475 {
@@ -6497,7 +6502,7 @@ static struct genl_ops nl80211_ops[] = {
6497 .doit = nl80211_del_mpath, 6502 .doit = nl80211_del_mpath,
6498 .policy = nl80211_policy, 6503 .policy = nl80211_policy,
6499 .flags = GENL_ADMIN_PERM, 6504 .flags = GENL_ADMIN_PERM,
6500 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6505 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6501 NL80211_FLAG_NEED_RTNL, 6506 NL80211_FLAG_NEED_RTNL,
6502 }, 6507 },
6503 { 6508 {
@@ -6505,7 +6510,7 @@ static struct genl_ops nl80211_ops[] = {
6505 .doit = nl80211_set_bss, 6510 .doit = nl80211_set_bss,
6506 .policy = nl80211_policy, 6511 .policy = nl80211_policy,
6507 .flags = GENL_ADMIN_PERM, 6512 .flags = GENL_ADMIN_PERM,
6508 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6513 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6509 NL80211_FLAG_NEED_RTNL, 6514 NL80211_FLAG_NEED_RTNL,
6510 }, 6515 },
6511 { 6516 {
@@ -6531,7 +6536,7 @@ static struct genl_ops nl80211_ops[] = {
6531 .doit = nl80211_get_mesh_config, 6536 .doit = nl80211_get_mesh_config,
6532 .policy = nl80211_policy, 6537 .policy = nl80211_policy,
6533 /* can be retrieved by unprivileged users */ 6538 /* can be retrieved by unprivileged users */
6534 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6539 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6535 NL80211_FLAG_NEED_RTNL, 6540 NL80211_FLAG_NEED_RTNL,
6536 }, 6541 },
6537 { 6542 {
@@ -6664,7 +6669,7 @@ static struct genl_ops nl80211_ops[] = {
6664 .doit = nl80211_setdel_pmksa, 6669 .doit = nl80211_setdel_pmksa,
6665 .policy = nl80211_policy, 6670 .policy = nl80211_policy,
6666 .flags = GENL_ADMIN_PERM, 6671 .flags = GENL_ADMIN_PERM,
6667 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6672 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6668 NL80211_FLAG_NEED_RTNL, 6673 NL80211_FLAG_NEED_RTNL,
6669 }, 6674 },
6670 { 6675 {
@@ -6672,7 +6677,7 @@ static struct genl_ops nl80211_ops[] = {
6672 .doit = nl80211_setdel_pmksa, 6677 .doit = nl80211_setdel_pmksa,
6673 .policy = nl80211_policy, 6678 .policy = nl80211_policy,
6674 .flags = GENL_ADMIN_PERM, 6679 .flags = GENL_ADMIN_PERM,
6675 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6680 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6676 NL80211_FLAG_NEED_RTNL, 6681 NL80211_FLAG_NEED_RTNL,
6677 }, 6682 },
6678 { 6683 {
@@ -6680,7 +6685,7 @@ static struct genl_ops nl80211_ops[] = {
6680 .doit = nl80211_flush_pmksa, 6685 .doit = nl80211_flush_pmksa,
6681 .policy = nl80211_policy, 6686 .policy = nl80211_policy,
6682 .flags = GENL_ADMIN_PERM, 6687 .flags = GENL_ADMIN_PERM,
6683 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6688 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6684 NL80211_FLAG_NEED_RTNL, 6689 NL80211_FLAG_NEED_RTNL,
6685 }, 6690 },
6686 { 6691 {
@@ -6840,7 +6845,7 @@ static struct genl_ops nl80211_ops[] = {
6840 .doit = nl80211_probe_client, 6845 .doit = nl80211_probe_client,
6841 .policy = nl80211_policy, 6846 .policy = nl80211_policy,
6842 .flags = GENL_ADMIN_PERM, 6847 .flags = GENL_ADMIN_PERM,
6843 .internal_flags = NL80211_FLAG_NEED_NETDEV | 6848 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
6844 NL80211_FLAG_NEED_RTNL, 6849 NL80211_FLAG_NEED_RTNL,
6845 }, 6850 },
6846 { 6851 {