aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
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();