aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-09-16 14:39:36 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-24 16:18:00 -0400
commit92ffe055c3ea45856183bebed62f8880f75fef3b (patch)
treee595450d94253fbf06532e93298311b59fa36c49 /net/wireless/nl80211.c
parentf8b25cdad719cddceb9cf0d350065b3e59e74219 (diff)
cfg80211: reject invalid configuration items
Reject configuring mesh-id for non-mesh, monitor flags for non-monitor. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a745932d137..572793c8c7a 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(&params, 0, sizeof(params)); 423 memset(&params, 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, &params); 466 type, flags, &params);
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));