aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-06-09 15:04:43 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 14:57:38 -0400
commite36d56b64808aec54b68b4e9976180c1da0933b2 (patch)
tree93f0e696d077b58d1064f3321d52b4611addf104 /net/wireless/nl80211.c
parente5a8a896f5180f2950695d2d0b79db348d200ca4 (diff)
cfg80211: pass netdev to change_virtual_intf
If there was a reason I'm passing the ifidx I cannot remember it any more and don't see one now, so let's just pass the pointer itself. 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.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 43bdb1372cae..f91e5d472c60 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();