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.c45
1 files changed, 12 insertions, 33 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 524f55402838..4fed1663aba3 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -876,48 +876,25 @@ static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info)
876 876
877static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info) 877static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info)
878{ 878{
879 struct cfg80211_registered_device *rdev; 879 struct cfg80211_registered_device *rdev = info->user_ptr[0];
880 struct wireless_dev *wdev; 880 struct net_device *dev = info->user_ptr[1];
881 struct net_device *dev; 881 struct wireless_dev *wdev = dev->ieee80211_ptr;
882 u8 *bssid; 882 u8 *bssid;
883 int err;
884 883
885 if (!info->attrs[NL80211_ATTR_MAC]) 884 if (!info->attrs[NL80211_ATTR_MAC])
886 return -EINVAL; 885 return -EINVAL;
887 886
888 rtnl_lock(); 887 if (netif_running(dev))
889 888 return -EBUSY;
890 err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev);
891 if (err)
892 goto unlock_rtnl;
893
894 wdev = dev->ieee80211_ptr;
895
896 if (netif_running(dev)) {
897 err = -EBUSY;
898 goto out;
899 }
900 889
901 if (!rdev->ops->set_wds_peer) { 890 if (!rdev->ops->set_wds_peer)
902 err = -EOPNOTSUPP; 891 return -EOPNOTSUPP;
903 goto out;
904 }
905 892
906 if (wdev->iftype != NL80211_IFTYPE_WDS) { 893 if (wdev->iftype != NL80211_IFTYPE_WDS)
907 err = -EOPNOTSUPP; 894 return -EOPNOTSUPP;
908 goto out;
909 }
910 895
911 bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); 896 bssid = nla_data(info->attrs[NL80211_ATTR_MAC]);
912 err = rdev->ops->set_wds_peer(wdev->wiphy, dev, bssid); 897 return rdev->ops->set_wds_peer(wdev->wiphy, dev, bssid);
913
914out:
915 cfg80211_unlock_rdev(rdev);
916 dev_put(dev);
917unlock_rtnl:
918 rtnl_unlock();
919
920 return err;
921} 898}
922 899
923 900
@@ -4860,6 +4837,8 @@ static struct genl_ops nl80211_ops[] = {
4860 .doit = nl80211_set_wds_peer, 4837 .doit = nl80211_set_wds_peer,
4861 .policy = nl80211_policy, 4838 .policy = nl80211_policy,
4862 .flags = GENL_ADMIN_PERM, 4839 .flags = GENL_ADMIN_PERM,
4840 .internal_flags = NL80211_FLAG_NEED_NETDEV |
4841 NL80211_FLAG_NEED_RTNL,
4863 }, 4842 },
4864}; 4843};
4865 4844