aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwmc3200wifi/cfg80211.c9
-rw-r--r--drivers/net/wireless/rndis_wlan.c15
-rw-r--r--include/net/cfg80211.h3
-rw-r--r--net/mac80211/cfg.c9
-rw-r--r--net/wireless/nl80211.c12
-rw-r--r--net/wireless/wext-compat.c2
6 files changed, 17 insertions, 33 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/cfg80211.c b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
index 96f714e6e12..bc89b1ef0ca 100644
--- a/drivers/net/wireless/iwmc3200wifi/cfg80211.c
+++ b/drivers/net/wireless/iwmc3200wifi/cfg80211.c
@@ -167,20 +167,15 @@ int iwm_cfg80211_inform_bss(struct iwm_priv *iwm)
167 return 0; 167 return 0;
168} 168}
169 169
170static int iwm_cfg80211_change_iface(struct wiphy *wiphy, int ifindex, 170static int iwm_cfg80211_change_iface(struct wiphy *wiphy,
171 struct net_device *ndev,
171 enum nl80211_iftype type, u32 *flags, 172 enum nl80211_iftype type, u32 *flags,
172 struct vif_params *params) 173 struct vif_params *params)
173{ 174{
174 struct net_device *ndev;
175 struct wireless_dev *wdev; 175 struct wireless_dev *wdev;
176 struct iwm_priv *iwm; 176 struct iwm_priv *iwm;
177 u32 old_mode; 177 u32 old_mode;
178 178
179 /* we're under RTNL */
180 ndev = __dev_get_by_index(&init_net, ifindex);
181 if (!ndev)
182 return -ENODEV;
183
184 wdev = ndev->ieee80211_ptr; 179 wdev = ndev->ieee80211_ptr;
185 iwm = ndev_to_iwm(ndev); 180 iwm = ndev_to_iwm(ndev);
186 old_mode = iwm->conf.mode; 181 old_mode = iwm->conf.mode;
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 3bec3dbd345..e8b0793b030 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -420,7 +420,8 @@ struct rndis_wlan_private {
420/* 420/*
421 * cfg80211 ops 421 * cfg80211 ops
422 */ 422 */
423static int rndis_change_virtual_intf(struct wiphy *wiphy, int ifindex, 423static int rndis_change_virtual_intf(struct wiphy *wiphy,
424 struct net_device *dev,
424 enum nl80211_iftype type, u32 *flags, 425 enum nl80211_iftype type, u32 *flags,
425 struct vif_params *params); 426 struct vif_params *params);
426 427
@@ -1222,20 +1223,14 @@ static void set_multicast_list(struct usbnet *usbdev)
1222/* 1223/*
1223 * cfg80211 ops 1224 * cfg80211 ops
1224 */ 1225 */
1225static int rndis_change_virtual_intf(struct wiphy *wiphy, int ifindex, 1226static int rndis_change_virtual_intf(struct wiphy *wiphy,
1227 struct net_device *dev,
1226 enum nl80211_iftype type, u32 *flags, 1228 enum nl80211_iftype type, u32 *flags,
1227 struct vif_params *params) 1229 struct vif_params *params)
1228{ 1230{
1229 struct net_device *dev; 1231 struct usbnet *usbdev = netdev_priv(dev);
1230 struct usbnet *usbdev;
1231 int mode; 1232 int mode;
1232 1233
1233 /* we're under RTNL */
1234 dev = __dev_get_by_index(&init_net, ifindex);
1235 if (!dev)
1236 return -ENODEV;
1237 usbdev = netdev_priv(dev);
1238
1239 switch (type) { 1234 switch (type) {
1240 case NL80211_IFTYPE_ADHOC: 1235 case NL80211_IFTYPE_ADHOC:
1241 mode = NDIS_80211_INFRA_ADHOC; 1236 mode = NDIS_80211_INFRA_ADHOC;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1a21895b732..90f9bfa3bfc 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -866,7 +866,8 @@ struct cfg80211_ops {
866 enum nl80211_iftype type, u32 *flags, 866 enum nl80211_iftype type, u32 *flags,
867 struct vif_params *params); 867 struct vif_params *params);
868 int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); 868 int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
869 int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, 869 int (*change_virtual_intf)(struct wiphy *wiphy,
870 struct net_device *dev,
870 enum nl80211_iftype type, u32 *flags, 871 enum nl80211_iftype type, u32 *flags,
871 struct vif_params *params); 872 struct vif_params *params);
872 873
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 3f47276caeb..eb93eb6a9cc 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -74,19 +74,14 @@ static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex)
74 return 0; 74 return 0;
75} 75}
76 76
77static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex, 77static int ieee80211_change_iface(struct wiphy *wiphy,
78 struct net_device *dev,
78 enum nl80211_iftype type, u32 *flags, 79 enum nl80211_iftype type, u32 *flags,
79 struct vif_params *params) 80 struct vif_params *params)
80{ 81{
81 struct net_device *dev;
82 struct ieee80211_sub_if_data *sdata; 82 struct ieee80211_sub_if_data *sdata;
83 int ret; 83 int ret;
84 84
85 /* we're under RTNL */
86 dev = __dev_get_by_index(&init_net, ifindex);
87 if (!dev)
88 return -ENODEV;
89
90 if (!nl80211_type_check(type)) 85 if (!nl80211_type_check(type))
91 return -EINVAL; 86 return -EINVAL;
92 87
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 43bdb1372ca..f91e5d472c6 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -767,7 +767,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
767{ 767{
768 struct cfg80211_registered_device *drv; 768 struct cfg80211_registered_device *drv;
769 struct vif_params params; 769 struct vif_params params;
770 int err, ifindex; 770 int err;
771 enum nl80211_iftype otype, ntype; 771 enum nl80211_iftype otype, ntype;
772 struct net_device *dev; 772 struct net_device *dev;
773 u32 _flags, *flags = NULL; 773 u32 _flags, *flags = NULL;
@@ -781,9 +781,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
781 if (err) 781 if (err)
782 goto unlock_rtnl; 782 goto unlock_rtnl;
783 783
784 ifindex = dev->ifindex;
785 otype = ntype = dev->ieee80211_ptr->iftype; 784 otype = ntype = dev->ieee80211_ptr->iftype;
786 dev_put(dev);
787 785
788 if (info->attrs[NL80211_ATTR_IFTYPE]) { 786 if (info->attrs[NL80211_ATTR_IFTYPE]) {
789 ntype = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]); 787 ntype = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]);
@@ -826,20 +824,20 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
826 } 824 }
827 825
828 if (change) 826 if (change)
829 err = drv->ops->change_virtual_intf(&drv->wiphy, ifindex, 827 err = drv->ops->change_virtual_intf(&drv->wiphy, dev,
830 ntype, flags, &params); 828 ntype, flags, &params);
831 else 829 else
832 err = 0; 830 err = 0;
833 831
834 dev = __dev_get_by_index(&init_net, ifindex); 832 WARN_ON(!err && dev->ieee80211_ptr->iftype != ntype);
835 WARN_ON(!dev || (!err && dev->ieee80211_ptr->iftype != ntype));
836 833
837 if (dev && !err && (ntype != otype)) { 834 if (!err && (ntype != otype)) {
838 if (otype == NL80211_IFTYPE_ADHOC) 835 if (otype == NL80211_IFTYPE_ADHOC)
839 cfg80211_clear_ibss(dev, false); 836 cfg80211_clear_ibss(dev, false);
840 } 837 }
841 838
842 unlock: 839 unlock:
840 dev_put(dev);
843 cfg80211_put_dev(drv); 841 cfg80211_put_dev(drv);
844 unlock_rtnl: 842 unlock_rtnl:
845 rtnl_unlock(); 843 rtnl_unlock();
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index d030c531567..9e56f3569e3 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -103,7 +103,7 @@ int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
103 103
104 memset(&vifparams, 0, sizeof(vifparams)); 104 memset(&vifparams, 0, sizeof(vifparams));
105 105
106 ret = rdev->ops->change_virtual_intf(wdev->wiphy, dev->ifindex, type, 106 ret = rdev->ops->change_virtual_intf(wdev->wiphy, dev, type,
107 NULL, &vifparams); 107 NULL, &vifparams);
108 WARN_ON(!ret && wdev->iftype != type); 108 WARN_ON(!ret && wdev->iftype != type);
109 109