diff options
-rw-r--r-- | net/wireless/nl80211.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index a745932d1370..572793c8c7ab 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -418,7 +418,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info) | |||
418 | int err, ifindex; | 418 | int err, ifindex; |
419 | enum nl80211_iftype type; | 419 | enum nl80211_iftype type; |
420 | struct net_device *dev; | 420 | struct net_device *dev; |
421 | u32 flags; | 421 | u32 _flags, *flags = NULL; |
422 | 422 | ||
423 | memset(¶ms, 0, sizeof(params)); | 423 | memset(¶ms, 0, sizeof(params)); |
424 | 424 | ||
@@ -442,18 +442,28 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info) | |||
442 | goto unlock; | 442 | goto unlock; |
443 | } | 443 | } |
444 | 444 | ||
445 | if (type == NL80211_IFTYPE_MESH_POINT && | 445 | if (info->attrs[NL80211_ATTR_MESH_ID]) { |
446 | info->attrs[NL80211_ATTR_MESH_ID]) { | 446 | if (type != NL80211_IFTYPE_MESH_POINT) { |
447 | err = -EINVAL; | ||
448 | goto unlock; | ||
449 | } | ||
447 | params.mesh_id = nla_data(info->attrs[NL80211_ATTR_MESH_ID]); | 450 | params.mesh_id = nla_data(info->attrs[NL80211_ATTR_MESH_ID]); |
448 | params.mesh_id_len = nla_len(info->attrs[NL80211_ATTR_MESH_ID]); | 451 | params.mesh_id_len = nla_len(info->attrs[NL80211_ATTR_MESH_ID]); |
449 | } | 452 | } |
450 | 453 | ||
454 | if (info->attrs[NL80211_ATTR_MNTR_FLAGS]) { | ||
455 | if (type != NL80211_IFTYPE_MONITOR) { | ||
456 | err = -EINVAL; | ||
457 | goto unlock; | ||
458 | } | ||
459 | err = parse_monitor_flags(info->attrs[NL80211_ATTR_MNTR_FLAGS], | ||
460 | &_flags); | ||
461 | if (!err) | ||
462 | flags = &_flags; | ||
463 | } | ||
451 | rtnl_lock(); | 464 | rtnl_lock(); |
452 | err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ? | ||
453 | info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, | ||
454 | &flags); | ||
455 | err = drv->ops->change_virtual_intf(&drv->wiphy, ifindex, | 465 | err = drv->ops->change_virtual_intf(&drv->wiphy, ifindex, |
456 | type, err ? NULL : &flags, ¶ms); | 466 | type, flags, ¶ms); |
457 | 467 | ||
458 | dev = __dev_get_by_index(&init_net, ifindex); | 468 | dev = __dev_get_by_index(&init_net, ifindex); |
459 | WARN_ON(!dev || (!err && dev->ieee80211_ptr->iftype != type)); | 469 | WARN_ON(!dev || (!err && dev->ieee80211_ptr->iftype != type)); |