diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/cfg.c | 20 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 7 |
2 files changed, 17 insertions, 10 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index ce6936890c26..d34c7c3dd762 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -19,9 +19,10 @@ | |||
19 | #include "rate.h" | 19 | #include "rate.h" |
20 | #include "mesh.h" | 20 | #include "mesh.h" |
21 | 21 | ||
22 | static int ieee80211_add_iface(struct wiphy *wiphy, char *name, | 22 | static struct net_device *ieee80211_add_iface(struct wiphy *wiphy, char *name, |
23 | enum nl80211_iftype type, u32 *flags, | 23 | enum nl80211_iftype type, |
24 | struct vif_params *params) | 24 | u32 *flags, |
25 | struct vif_params *params) | ||
25 | { | 26 | { |
26 | struct ieee80211_local *local = wiphy_priv(wiphy); | 27 | struct ieee80211_local *local = wiphy_priv(wiphy); |
27 | struct net_device *dev; | 28 | struct net_device *dev; |
@@ -29,12 +30,15 @@ static int ieee80211_add_iface(struct wiphy *wiphy, char *name, | |||
29 | int err; | 30 | int err; |
30 | 31 | ||
31 | err = ieee80211_if_add(local, name, &dev, type, params); | 32 | err = ieee80211_if_add(local, name, &dev, type, params); |
32 | if (err || type != NL80211_IFTYPE_MONITOR || !flags) | 33 | if (err) |
33 | return err; | 34 | return ERR_PTR(err); |
34 | 35 | ||
35 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 36 | if (type == NL80211_IFTYPE_MONITOR && flags) { |
36 | sdata->u.mntr_flags = *flags; | 37 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
37 | return 0; | 38 | sdata->u.mntr_flags = *flags; |
39 | } | ||
40 | |||
41 | return dev; | ||
38 | } | 42 | } |
39 | 43 | ||
40 | static int ieee80211_del_iface(struct wiphy *wiphy, struct net_device *dev) | 44 | static int ieee80211_del_iface(struct wiphy *wiphy, struct net_device *dev) |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 0b90cab5da2f..cc2e5d6163de 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -1368,6 +1368,7 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) | |||
1368 | { | 1368 | { |
1369 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 1369 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
1370 | struct vif_params params; | 1370 | struct vif_params params; |
1371 | struct net_device *dev; | ||
1371 | int err; | 1372 | int err; |
1372 | enum nl80211_iftype type = NL80211_IFTYPE_UNSPECIFIED; | 1373 | enum nl80211_iftype type = NL80211_IFTYPE_UNSPECIFIED; |
1373 | u32 flags; | 1374 | u32 flags; |
@@ -1403,11 +1404,13 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) | |||
1403 | err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ? | 1404 | err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ? |
1404 | info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, | 1405 | info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, |
1405 | &flags); | 1406 | &flags); |
1406 | err = rdev->ops->add_virtual_intf(&rdev->wiphy, | 1407 | dev = rdev->ops->add_virtual_intf(&rdev->wiphy, |
1407 | nla_data(info->attrs[NL80211_ATTR_IFNAME]), | 1408 | nla_data(info->attrs[NL80211_ATTR_IFNAME]), |
1408 | type, err ? NULL : &flags, ¶ms); | 1409 | type, err ? NULL : &flags, ¶ms); |
1410 | if (IS_ERR(dev)) | ||
1411 | return PTR_ERR(dev); | ||
1409 | 1412 | ||
1410 | return err; | 1413 | return 0; |
1411 | } | 1414 | } |
1412 | 1415 | ||
1413 | static int nl80211_del_interface(struct sk_buff *skb, struct genl_info *info) | 1416 | static int nl80211_del_interface(struct sk_buff *skb, struct genl_info *info) |