diff options
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 266 |
1 files changed, 205 insertions, 61 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 1e37dbf00cb3..0418a6d5c1a6 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -496,11 +496,11 @@ static bool is_valid_ie_attr(const struct nlattr *attr) | |||
496 | } | 496 | } |
497 | 497 | ||
498 | /* message building helper */ | 498 | /* message building helper */ |
499 | static inline void *nl80211hdr_put(struct sk_buff *skb, u32 pid, u32 seq, | 499 | static inline void *nl80211hdr_put(struct sk_buff *skb, u32 portid, u32 seq, |
500 | int flags, u8 cmd) | 500 | int flags, u8 cmd) |
501 | { | 501 | { |
502 | /* since there is no private header just add the generic one */ | 502 | /* since there is no private header just add the generic one */ |
503 | return genlmsg_put(skb, pid, seq, &nl80211_fam, flags, cmd); | 503 | return genlmsg_put(skb, portid, seq, &nl80211_fam, flags, cmd); |
504 | } | 504 | } |
505 | 505 | ||
506 | static int nl80211_msg_put_channel(struct sk_buff *msg, | 506 | static int nl80211_msg_put_channel(struct sk_buff *msg, |
@@ -851,7 +851,7 @@ nla_put_failure: | |||
851 | return -ENOBUFS; | 851 | return -ENOBUFS; |
852 | } | 852 | } |
853 | 853 | ||
854 | static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, | 854 | static int nl80211_send_wiphy(struct sk_buff *msg, u32 portid, u32 seq, int flags, |
855 | struct cfg80211_registered_device *dev) | 855 | struct cfg80211_registered_device *dev) |
856 | { | 856 | { |
857 | void *hdr; | 857 | void *hdr; |
@@ -866,7 +866,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, | |||
866 | const struct ieee80211_txrx_stypes *mgmt_stypes = | 866 | const struct ieee80211_txrx_stypes *mgmt_stypes = |
867 | dev->wiphy.mgmt_stypes; | 867 | dev->wiphy.mgmt_stypes; |
868 | 868 | ||
869 | hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_WIPHY); | 869 | hdr = nl80211hdr_put(msg, portid, seq, flags, NL80211_CMD_NEW_WIPHY); |
870 | if (!hdr) | 870 | if (!hdr) |
871 | return -1; | 871 | return -1; |
872 | 872 | ||
@@ -1100,6 +1100,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, | |||
1100 | if (nla_put_u32(msg, i, NL80211_CMD_REGISTER_BEACONS)) | 1100 | if (nla_put_u32(msg, i, NL80211_CMD_REGISTER_BEACONS)) |
1101 | goto nla_put_failure; | 1101 | goto nla_put_failure; |
1102 | } | 1102 | } |
1103 | CMD(start_p2p_device, START_P2P_DEVICE); | ||
1103 | 1104 | ||
1104 | #ifdef CONFIG_NL80211_TESTMODE | 1105 | #ifdef CONFIG_NL80211_TESTMODE |
1105 | CMD(testmode_cmd, TESTMODE); | 1106 | CMD(testmode_cmd, TESTMODE); |
@@ -1266,7 +1267,7 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) | |||
1266 | continue; | 1267 | continue; |
1267 | if (++idx <= start) | 1268 | if (++idx <= start) |
1268 | continue; | 1269 | continue; |
1269 | if (nl80211_send_wiphy(skb, NETLINK_CB(cb->skb).pid, | 1270 | if (nl80211_send_wiphy(skb, NETLINK_CB(cb->skb).portid, |
1270 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 1271 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
1271 | dev) < 0) { | 1272 | dev) < 0) { |
1272 | idx--; | 1273 | idx--; |
@@ -1289,7 +1290,7 @@ static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
1289 | if (!msg) | 1290 | if (!msg) |
1290 | return -ENOMEM; | 1291 | return -ENOMEM; |
1291 | 1292 | ||
1292 | if (nl80211_send_wiphy(msg, info->snd_pid, info->snd_seq, 0, dev) < 0) { | 1293 | if (nl80211_send_wiphy(msg, info->snd_portid, info->snd_seq, 0, dev) < 0) { |
1293 | nlmsg_free(msg); | 1294 | nlmsg_free(msg); |
1294 | return -ENOBUFS; | 1295 | return -ENOBUFS; |
1295 | } | 1296 | } |
@@ -1735,26 +1736,26 @@ static inline u64 wdev_id(struct wireless_dev *wdev) | |||
1735 | ((u64)wiphy_to_dev(wdev->wiphy)->wiphy_idx << 32); | 1736 | ((u64)wiphy_to_dev(wdev->wiphy)->wiphy_idx << 32); |
1736 | } | 1737 | } |
1737 | 1738 | ||
1738 | static int nl80211_send_iface(struct sk_buff *msg, u32 pid, u32 seq, int flags, | 1739 | static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags, |
1739 | struct cfg80211_registered_device *rdev, | 1740 | struct cfg80211_registered_device *rdev, |
1740 | struct wireless_dev *wdev) | 1741 | struct wireless_dev *wdev) |
1741 | { | 1742 | { |
1742 | struct net_device *dev = wdev->netdev; | 1743 | struct net_device *dev = wdev->netdev; |
1743 | void *hdr; | 1744 | void *hdr; |
1744 | 1745 | ||
1745 | hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_INTERFACE); | 1746 | hdr = nl80211hdr_put(msg, portid, seq, flags, NL80211_CMD_NEW_INTERFACE); |
1746 | if (!hdr) | 1747 | if (!hdr) |
1747 | return -1; | 1748 | return -1; |
1748 | 1749 | ||
1749 | if (dev && | 1750 | if (dev && |
1750 | (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || | 1751 | (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || |
1751 | nla_put_string(msg, NL80211_ATTR_IFNAME, dev->name) || | 1752 | nla_put_string(msg, NL80211_ATTR_IFNAME, dev->name))) |
1752 | nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, dev->dev_addr))) | ||
1753 | goto nla_put_failure; | 1753 | goto nla_put_failure; |
1754 | 1754 | ||
1755 | if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || | 1755 | if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || |
1756 | nla_put_u32(msg, NL80211_ATTR_IFTYPE, wdev->iftype) || | 1756 | nla_put_u32(msg, NL80211_ATTR_IFTYPE, wdev->iftype) || |
1757 | nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) || | 1757 | nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) || |
1758 | nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, wdev_address(wdev)) || | ||
1758 | nla_put_u32(msg, NL80211_ATTR_GENERATION, | 1759 | nla_put_u32(msg, NL80211_ATTR_GENERATION, |
1759 | rdev->devlist_generation ^ | 1760 | rdev->devlist_generation ^ |
1760 | (cfg80211_rdev_list_generation << 2))) | 1761 | (cfg80211_rdev_list_generation << 2))) |
@@ -1806,7 +1807,7 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback * | |||
1806 | if_idx++; | 1807 | if_idx++; |
1807 | continue; | 1808 | continue; |
1808 | } | 1809 | } |
1809 | if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).pid, | 1810 | if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).portid, |
1810 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 1811 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
1811 | rdev, wdev) < 0) { | 1812 | rdev, wdev) < 0) { |
1812 | mutex_unlock(&rdev->devlist_mtx); | 1813 | mutex_unlock(&rdev->devlist_mtx); |
@@ -1837,7 +1838,7 @@ static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info) | |||
1837 | if (!msg) | 1838 | if (!msg) |
1838 | return -ENOMEM; | 1839 | return -ENOMEM; |
1839 | 1840 | ||
1840 | if (nl80211_send_iface(msg, info->snd_pid, info->snd_seq, 0, | 1841 | if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0, |
1841 | dev, wdev) < 0) { | 1842 | dev, wdev) < 0) { |
1842 | nlmsg_free(msg); | 1843 | nlmsg_free(msg); |
1843 | return -ENOBUFS; | 1844 | return -ENOBUFS; |
@@ -2021,8 +2022,10 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) | |||
2021 | return PTR_ERR(wdev); | 2022 | return PTR_ERR(wdev); |
2022 | } | 2023 | } |
2023 | 2024 | ||
2024 | if (type == NL80211_IFTYPE_MESH_POINT && | 2025 | switch (type) { |
2025 | info->attrs[NL80211_ATTR_MESH_ID]) { | 2026 | case NL80211_IFTYPE_MESH_POINT: |
2027 | if (!info->attrs[NL80211_ATTR_MESH_ID]) | ||
2028 | break; | ||
2026 | wdev_lock(wdev); | 2029 | wdev_lock(wdev); |
2027 | BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != | 2030 | BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != |
2028 | IEEE80211_MAX_MESH_ID_LEN); | 2031 | IEEE80211_MAX_MESH_ID_LEN); |
@@ -2031,9 +2034,29 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) | |||
2031 | memcpy(wdev->ssid, nla_data(info->attrs[NL80211_ATTR_MESH_ID]), | 2034 | memcpy(wdev->ssid, nla_data(info->attrs[NL80211_ATTR_MESH_ID]), |
2032 | wdev->mesh_id_up_len); | 2035 | wdev->mesh_id_up_len); |
2033 | wdev_unlock(wdev); | 2036 | wdev_unlock(wdev); |
2037 | break; | ||
2038 | case NL80211_IFTYPE_P2P_DEVICE: | ||
2039 | /* | ||
2040 | * P2P Device doesn't have a netdev, so doesn't go | ||
2041 | * through the netdev notifier and must be added here | ||
2042 | */ | ||
2043 | mutex_init(&wdev->mtx); | ||
2044 | INIT_LIST_HEAD(&wdev->event_list); | ||
2045 | spin_lock_init(&wdev->event_lock); | ||
2046 | INIT_LIST_HEAD(&wdev->mgmt_registrations); | ||
2047 | spin_lock_init(&wdev->mgmt_registrations_lock); | ||
2048 | |||
2049 | mutex_lock(&rdev->devlist_mtx); | ||
2050 | wdev->identifier = ++rdev->wdev_id; | ||
2051 | list_add_rcu(&wdev->list, &rdev->wdev_list); | ||
2052 | rdev->devlist_generation++; | ||
2053 | mutex_unlock(&rdev->devlist_mtx); | ||
2054 | break; | ||
2055 | default: | ||
2056 | break; | ||
2034 | } | 2057 | } |
2035 | 2058 | ||
2036 | if (nl80211_send_iface(msg, info->snd_pid, info->snd_seq, 0, | 2059 | if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0, |
2037 | rdev, wdev) < 0) { | 2060 | rdev, wdev) < 0) { |
2038 | nlmsg_free(msg); | 2061 | nlmsg_free(msg); |
2039 | return -ENOBUFS; | 2062 | return -ENOBUFS; |
@@ -2168,7 +2191,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info) | |||
2168 | if (!msg) | 2191 | if (!msg) |
2169 | return -ENOMEM; | 2192 | return -ENOMEM; |
2170 | 2193 | ||
2171 | hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, | 2194 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
2172 | NL80211_CMD_NEW_KEY); | 2195 | NL80211_CMD_NEW_KEY); |
2173 | if (IS_ERR(hdr)) | 2196 | if (IS_ERR(hdr)) |
2174 | return PTR_ERR(hdr); | 2197 | return PTR_ERR(hdr); |
@@ -2746,7 +2769,7 @@ nla_put_failure: | |||
2746 | return false; | 2769 | return false; |
2747 | } | 2770 | } |
2748 | 2771 | ||
2749 | static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, | 2772 | static int nl80211_send_station(struct sk_buff *msg, u32 portid, u32 seq, |
2750 | int flags, | 2773 | int flags, |
2751 | struct cfg80211_registered_device *rdev, | 2774 | struct cfg80211_registered_device *rdev, |
2752 | struct net_device *dev, | 2775 | struct net_device *dev, |
@@ -2755,7 +2778,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, | |||
2755 | void *hdr; | 2778 | void *hdr; |
2756 | struct nlattr *sinfoattr, *bss_param; | 2779 | struct nlattr *sinfoattr, *bss_param; |
2757 | 2780 | ||
2758 | hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_STATION); | 2781 | hdr = nl80211hdr_put(msg, portid, seq, flags, NL80211_CMD_NEW_STATION); |
2759 | if (!hdr) | 2782 | if (!hdr) |
2760 | return -1; | 2783 | return -1; |
2761 | 2784 | ||
@@ -2908,7 +2931,7 @@ static int nl80211_dump_station(struct sk_buff *skb, | |||
2908 | goto out_err; | 2931 | goto out_err; |
2909 | 2932 | ||
2910 | if (nl80211_send_station(skb, | 2933 | if (nl80211_send_station(skb, |
2911 | NETLINK_CB(cb->skb).pid, | 2934 | NETLINK_CB(cb->skb).portid, |
2912 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 2935 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
2913 | dev, netdev, mac_addr, | 2936 | dev, netdev, mac_addr, |
2914 | &sinfo) < 0) | 2937 | &sinfo) < 0) |
@@ -2954,7 +2977,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info) | |||
2954 | if (!msg) | 2977 | if (!msg) |
2955 | return -ENOMEM; | 2978 | return -ENOMEM; |
2956 | 2979 | ||
2957 | if (nl80211_send_station(msg, info->snd_pid, info->snd_seq, 0, | 2980 | if (nl80211_send_station(msg, info->snd_portid, info->snd_seq, 0, |
2958 | rdev, dev, mac_addr, &sinfo) < 0) { | 2981 | rdev, dev, mac_addr, &sinfo) < 0) { |
2959 | nlmsg_free(msg); | 2982 | nlmsg_free(msg); |
2960 | return -ENOBUFS; | 2983 | return -ENOBUFS; |
@@ -3280,7 +3303,7 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info) | |||
3280 | return rdev->ops->del_station(&rdev->wiphy, dev, mac_addr); | 3303 | return rdev->ops->del_station(&rdev->wiphy, dev, mac_addr); |
3281 | } | 3304 | } |
3282 | 3305 | ||
3283 | static int nl80211_send_mpath(struct sk_buff *msg, u32 pid, u32 seq, | 3306 | static int nl80211_send_mpath(struct sk_buff *msg, u32 portid, u32 seq, |
3284 | int flags, struct net_device *dev, | 3307 | int flags, struct net_device *dev, |
3285 | u8 *dst, u8 *next_hop, | 3308 | u8 *dst, u8 *next_hop, |
3286 | struct mpath_info *pinfo) | 3309 | struct mpath_info *pinfo) |
@@ -3288,7 +3311,7 @@ static int nl80211_send_mpath(struct sk_buff *msg, u32 pid, u32 seq, | |||
3288 | void *hdr; | 3311 | void *hdr; |
3289 | struct nlattr *pinfoattr; | 3312 | struct nlattr *pinfoattr; |
3290 | 3313 | ||
3291 | hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_STATION); | 3314 | hdr = nl80211hdr_put(msg, portid, seq, flags, NL80211_CMD_NEW_STATION); |
3292 | if (!hdr) | 3315 | if (!hdr) |
3293 | return -1; | 3316 | return -1; |
3294 | 3317 | ||
@@ -3366,7 +3389,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb, | |||
3366 | if (err) | 3389 | if (err) |
3367 | goto out_err; | 3390 | goto out_err; |
3368 | 3391 | ||
3369 | if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).pid, | 3392 | if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).portid, |
3370 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 3393 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
3371 | netdev, dst, next_hop, | 3394 | netdev, dst, next_hop, |
3372 | &pinfo) < 0) | 3395 | &pinfo) < 0) |
@@ -3415,7 +3438,7 @@ static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info) | |||
3415 | if (!msg) | 3438 | if (!msg) |
3416 | return -ENOMEM; | 3439 | return -ENOMEM; |
3417 | 3440 | ||
3418 | if (nl80211_send_mpath(msg, info->snd_pid, info->snd_seq, 0, | 3441 | if (nl80211_send_mpath(msg, info->snd_portid, info->snd_seq, 0, |
3419 | dev, dst, next_hop, &pinfo) < 0) { | 3442 | dev, dst, next_hop, &pinfo) < 0) { |
3420 | nlmsg_free(msg); | 3443 | nlmsg_free(msg); |
3421 | return -ENOBUFS; | 3444 | return -ENOBUFS; |
@@ -3656,7 +3679,7 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, | |||
3656 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 3679 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
3657 | if (!msg) | 3680 | if (!msg) |
3658 | return -ENOMEM; | 3681 | return -ENOMEM; |
3659 | hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, | 3682 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
3660 | NL80211_CMD_GET_MESH_CONFIG); | 3683 | NL80211_CMD_GET_MESH_CONFIG); |
3661 | if (!hdr) | 3684 | if (!hdr) |
3662 | goto out; | 3685 | goto out; |
@@ -3975,7 +3998,7 @@ static int nl80211_get_reg(struct sk_buff *skb, struct genl_info *info) | |||
3975 | goto out; | 3998 | goto out; |
3976 | } | 3999 | } |
3977 | 4000 | ||
3978 | hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, | 4001 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
3979 | NL80211_CMD_GET_REG); | 4002 | NL80211_CMD_GET_REG); |
3980 | if (!hdr) | 4003 | if (!hdr) |
3981 | goto put_failure; | 4004 | goto put_failure; |
@@ -4593,7 +4616,7 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, | |||
4593 | 4616 | ||
4594 | ASSERT_WDEV_LOCK(wdev); | 4617 | ASSERT_WDEV_LOCK(wdev); |
4595 | 4618 | ||
4596 | hdr = nl80211hdr_put(msg, NETLINK_CB(cb->skb).pid, seq, flags, | 4619 | hdr = nl80211hdr_put(msg, NETLINK_CB(cb->skb).portid, seq, flags, |
4597 | NL80211_CMD_NEW_SCAN_RESULTS); | 4620 | NL80211_CMD_NEW_SCAN_RESULTS); |
4598 | if (!hdr) | 4621 | if (!hdr) |
4599 | return -1; | 4622 | return -1; |
@@ -4712,14 +4735,14 @@ static int nl80211_dump_scan(struct sk_buff *skb, | |||
4712 | return skb->len; | 4735 | return skb->len; |
4713 | } | 4736 | } |
4714 | 4737 | ||
4715 | static int nl80211_send_survey(struct sk_buff *msg, u32 pid, u32 seq, | 4738 | static int nl80211_send_survey(struct sk_buff *msg, u32 portid, u32 seq, |
4716 | int flags, struct net_device *dev, | 4739 | int flags, struct net_device *dev, |
4717 | struct survey_info *survey) | 4740 | struct survey_info *survey) |
4718 | { | 4741 | { |
4719 | void *hdr; | 4742 | void *hdr; |
4720 | struct nlattr *infoattr; | 4743 | struct nlattr *infoattr; |
4721 | 4744 | ||
4722 | hdr = nl80211hdr_put(msg, pid, seq, flags, | 4745 | hdr = nl80211hdr_put(msg, portid, seq, flags, |
4723 | NL80211_CMD_NEW_SURVEY_RESULTS); | 4746 | NL80211_CMD_NEW_SURVEY_RESULTS); |
4724 | if (!hdr) | 4747 | if (!hdr) |
4725 | return -ENOMEM; | 4748 | return -ENOMEM; |
@@ -4813,7 +4836,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, | |||
4813 | } | 4836 | } |
4814 | 4837 | ||
4815 | if (nl80211_send_survey(skb, | 4838 | if (nl80211_send_survey(skb, |
4816 | NETLINK_CB(cb->skb).pid, | 4839 | NETLINK_CB(cb->skb).portid, |
4817 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 4840 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
4818 | netdev, | 4841 | netdev, |
4819 | &survey) < 0) | 4842 | &survey) < 0) |
@@ -5428,7 +5451,7 @@ static int nl80211_testmode_dump(struct sk_buff *skb, | |||
5428 | } | 5451 | } |
5429 | 5452 | ||
5430 | while (1) { | 5453 | while (1) { |
5431 | void *hdr = nl80211hdr_put(skb, NETLINK_CB(cb->skb).pid, | 5454 | void *hdr = nl80211hdr_put(skb, NETLINK_CB(cb->skb).portid, |
5432 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 5455 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
5433 | NL80211_CMD_TESTMODE); | 5456 | NL80211_CMD_TESTMODE); |
5434 | struct nlattr *tmdata; | 5457 | struct nlattr *tmdata; |
@@ -5468,7 +5491,7 @@ static int nl80211_testmode_dump(struct sk_buff *skb, | |||
5468 | 5491 | ||
5469 | static struct sk_buff * | 5492 | static struct sk_buff * |
5470 | __cfg80211_testmode_alloc_skb(struct cfg80211_registered_device *rdev, | 5493 | __cfg80211_testmode_alloc_skb(struct cfg80211_registered_device *rdev, |
5471 | int approxlen, u32 pid, u32 seq, gfp_t gfp) | 5494 | int approxlen, u32 portid, u32 seq, gfp_t gfp) |
5472 | { | 5495 | { |
5473 | struct sk_buff *skb; | 5496 | struct sk_buff *skb; |
5474 | void *hdr; | 5497 | void *hdr; |
@@ -5478,7 +5501,7 @@ __cfg80211_testmode_alloc_skb(struct cfg80211_registered_device *rdev, | |||
5478 | if (!skb) | 5501 | if (!skb) |
5479 | return NULL; | 5502 | return NULL; |
5480 | 5503 | ||
5481 | hdr = nl80211hdr_put(skb, pid, seq, 0, NL80211_CMD_TESTMODE); | 5504 | hdr = nl80211hdr_put(skb, portid, seq, 0, NL80211_CMD_TESTMODE); |
5482 | if (!hdr) { | 5505 | if (!hdr) { |
5483 | kfree_skb(skb); | 5506 | kfree_skb(skb); |
5484 | return NULL; | 5507 | return NULL; |
@@ -5508,7 +5531,7 @@ struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, | |||
5508 | return NULL; | 5531 | return NULL; |
5509 | 5532 | ||
5510 | return __cfg80211_testmode_alloc_skb(rdev, approxlen, | 5533 | return __cfg80211_testmode_alloc_skb(rdev, approxlen, |
5511 | rdev->testmode_info->snd_pid, | 5534 | rdev->testmode_info->snd_portid, |
5512 | rdev->testmode_info->snd_seq, | 5535 | rdev->testmode_info->snd_seq, |
5513 | GFP_KERNEL); | 5536 | GFP_KERNEL); |
5514 | } | 5537 | } |
@@ -5846,7 +5869,7 @@ static int nl80211_remain_on_channel(struct sk_buff *skb, | |||
5846 | if (!msg) | 5869 | if (!msg) |
5847 | return -ENOMEM; | 5870 | return -ENOMEM; |
5848 | 5871 | ||
5849 | hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, | 5872 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
5850 | NL80211_CMD_REMAIN_ON_CHANNEL); | 5873 | NL80211_CMD_REMAIN_ON_CHANNEL); |
5851 | 5874 | ||
5852 | if (IS_ERR(hdr)) { | 5875 | if (IS_ERR(hdr)) { |
@@ -6055,6 +6078,7 @@ static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
6055 | case NL80211_IFTYPE_AP_VLAN: | 6078 | case NL80211_IFTYPE_AP_VLAN: |
6056 | case NL80211_IFTYPE_MESH_POINT: | 6079 | case NL80211_IFTYPE_MESH_POINT: |
6057 | case NL80211_IFTYPE_P2P_GO: | 6080 | case NL80211_IFTYPE_P2P_GO: |
6081 | case NL80211_IFTYPE_P2P_DEVICE: | ||
6058 | break; | 6082 | break; |
6059 | default: | 6083 | default: |
6060 | return -EOPNOTSUPP; | 6084 | return -EOPNOTSUPP; |
@@ -6064,7 +6088,7 @@ static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
6064 | if (!rdev->ops->mgmt_tx) | 6088 | if (!rdev->ops->mgmt_tx) |
6065 | return -EOPNOTSUPP; | 6089 | return -EOPNOTSUPP; |
6066 | 6090 | ||
6067 | return cfg80211_mlme_register_mgmt(wdev, info->snd_pid, frame_type, | 6091 | return cfg80211_mlme_register_mgmt(wdev, info->snd_portid, frame_type, |
6068 | nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]), | 6092 | nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]), |
6069 | nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH])); | 6093 | nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH])); |
6070 | } | 6094 | } |
@@ -6101,6 +6125,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
6101 | case NL80211_IFTYPE_AP_VLAN: | 6125 | case NL80211_IFTYPE_AP_VLAN: |
6102 | case NL80211_IFTYPE_MESH_POINT: | 6126 | case NL80211_IFTYPE_MESH_POINT: |
6103 | case NL80211_IFTYPE_P2P_GO: | 6127 | case NL80211_IFTYPE_P2P_GO: |
6128 | case NL80211_IFTYPE_P2P_DEVICE: | ||
6104 | break; | 6129 | break; |
6105 | default: | 6130 | default: |
6106 | return -EOPNOTSUPP; | 6131 | return -EOPNOTSUPP; |
@@ -6144,7 +6169,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
6144 | if (!msg) | 6169 | if (!msg) |
6145 | return -ENOMEM; | 6170 | return -ENOMEM; |
6146 | 6171 | ||
6147 | hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, | 6172 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
6148 | NL80211_CMD_FRAME); | 6173 | NL80211_CMD_FRAME); |
6149 | 6174 | ||
6150 | if (IS_ERR(hdr)) { | 6175 | if (IS_ERR(hdr)) { |
@@ -6197,6 +6222,7 @@ static int nl80211_tx_mgmt_cancel_wait(struct sk_buff *skb, struct genl_info *in | |||
6197 | case NL80211_IFTYPE_AP: | 6222 | case NL80211_IFTYPE_AP: |
6198 | case NL80211_IFTYPE_AP_VLAN: | 6223 | case NL80211_IFTYPE_AP_VLAN: |
6199 | case NL80211_IFTYPE_P2P_GO: | 6224 | case NL80211_IFTYPE_P2P_GO: |
6225 | case NL80211_IFTYPE_P2P_DEVICE: | ||
6200 | break; | 6226 | break; |
6201 | default: | 6227 | default: |
6202 | return -EOPNOTSUPP; | 6228 | return -EOPNOTSUPP; |
@@ -6260,7 +6286,7 @@ static int nl80211_get_power_save(struct sk_buff *skb, struct genl_info *info) | |||
6260 | if (!msg) | 6286 | if (!msg) |
6261 | return -ENOMEM; | 6287 | return -ENOMEM; |
6262 | 6288 | ||
6263 | hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, | 6289 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
6264 | NL80211_CMD_GET_POWER_SAVE); | 6290 | NL80211_CMD_GET_POWER_SAVE); |
6265 | if (!hdr) { | 6291 | if (!hdr) { |
6266 | err = -ENOBUFS; | 6292 | err = -ENOBUFS; |
@@ -6462,7 +6488,7 @@ static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info) | |||
6462 | if (!msg) | 6488 | if (!msg) |
6463 | return -ENOMEM; | 6489 | return -ENOMEM; |
6464 | 6490 | ||
6465 | hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, | 6491 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
6466 | NL80211_CMD_GET_WOWLAN); | 6492 | NL80211_CMD_GET_WOWLAN); |
6467 | if (!hdr) | 6493 | if (!hdr) |
6468 | goto nla_put_failure; | 6494 | goto nla_put_failure; |
@@ -6736,10 +6762,10 @@ static int nl80211_register_unexpected_frame(struct sk_buff *skb, | |||
6736 | wdev->iftype != NL80211_IFTYPE_P2P_GO) | 6762 | wdev->iftype != NL80211_IFTYPE_P2P_GO) |
6737 | return -EINVAL; | 6763 | return -EINVAL; |
6738 | 6764 | ||
6739 | if (wdev->ap_unexpected_nlpid) | 6765 | if (wdev->ap_unexpected_nlportid) |
6740 | return -EBUSY; | 6766 | return -EBUSY; |
6741 | 6767 | ||
6742 | wdev->ap_unexpected_nlpid = info->snd_pid; | 6768 | wdev->ap_unexpected_nlportid = info->snd_portid; |
6743 | return 0; | 6769 | return 0; |
6744 | } | 6770 | } |
6745 | 6771 | ||
@@ -6769,7 +6795,7 @@ static int nl80211_probe_client(struct sk_buff *skb, | |||
6769 | if (!msg) | 6795 | if (!msg) |
6770 | return -ENOMEM; | 6796 | return -ENOMEM; |
6771 | 6797 | ||
6772 | hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, | 6798 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
6773 | NL80211_CMD_PROBE_CLIENT); | 6799 | NL80211_CMD_PROBE_CLIENT); |
6774 | 6800 | ||
6775 | if (IS_ERR(hdr)) { | 6801 | if (IS_ERR(hdr)) { |
@@ -6804,10 +6830,72 @@ static int nl80211_register_beacons(struct sk_buff *skb, struct genl_info *info) | |||
6804 | if (!(rdev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS)) | 6830 | if (!(rdev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS)) |
6805 | return -EOPNOTSUPP; | 6831 | return -EOPNOTSUPP; |
6806 | 6832 | ||
6807 | if (rdev->ap_beacons_nlpid) | 6833 | if (rdev->ap_beacons_nlportid) |
6808 | return -EBUSY; | 6834 | return -EBUSY; |
6809 | 6835 | ||
6810 | rdev->ap_beacons_nlpid = info->snd_pid; | 6836 | rdev->ap_beacons_nlportid = info->snd_portid; |
6837 | |||
6838 | return 0; | ||
6839 | } | ||
6840 | |||
6841 | static int nl80211_start_p2p_device(struct sk_buff *skb, struct genl_info *info) | ||
6842 | { | ||
6843 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | ||
6844 | struct wireless_dev *wdev = info->user_ptr[1]; | ||
6845 | int err; | ||
6846 | |||
6847 | if (!rdev->ops->start_p2p_device) | ||
6848 | return -EOPNOTSUPP; | ||
6849 | |||
6850 | if (wdev->iftype != NL80211_IFTYPE_P2P_DEVICE) | ||
6851 | return -EOPNOTSUPP; | ||
6852 | |||
6853 | if (wdev->p2p_started) | ||
6854 | return 0; | ||
6855 | |||
6856 | mutex_lock(&rdev->devlist_mtx); | ||
6857 | err = cfg80211_can_add_interface(rdev, wdev->iftype); | ||
6858 | mutex_unlock(&rdev->devlist_mtx); | ||
6859 | if (err) | ||
6860 | return err; | ||
6861 | |||
6862 | err = rdev->ops->start_p2p_device(&rdev->wiphy, wdev); | ||
6863 | if (err) | ||
6864 | return err; | ||
6865 | |||
6866 | wdev->p2p_started = true; | ||
6867 | mutex_lock(&rdev->devlist_mtx); | ||
6868 | rdev->opencount++; | ||
6869 | mutex_unlock(&rdev->devlist_mtx); | ||
6870 | |||
6871 | return 0; | ||
6872 | } | ||
6873 | |||
6874 | static int nl80211_stop_p2p_device(struct sk_buff *skb, struct genl_info *info) | ||
6875 | { | ||
6876 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | ||
6877 | struct wireless_dev *wdev = info->user_ptr[1]; | ||
6878 | |||
6879 | if (wdev->iftype != NL80211_IFTYPE_P2P_DEVICE) | ||
6880 | return -EOPNOTSUPP; | ||
6881 | |||
6882 | if (!rdev->ops->stop_p2p_device) | ||
6883 | return -EOPNOTSUPP; | ||
6884 | |||
6885 | if (!wdev->p2p_started) | ||
6886 | return 0; | ||
6887 | |||
6888 | rdev->ops->stop_p2p_device(&rdev->wiphy, wdev); | ||
6889 | wdev->p2p_started = false; | ||
6890 | |||
6891 | mutex_lock(&rdev->devlist_mtx); | ||
6892 | rdev->opencount--; | ||
6893 | mutex_unlock(&rdev->devlist_mtx); | ||
6894 | |||
6895 | if (WARN_ON(rdev->scan_req && rdev->scan_req->wdev == wdev)) { | ||
6896 | rdev->scan_req->aborted = true; | ||
6897 | ___cfg80211_scan_done(rdev, true); | ||
6898 | } | ||
6811 | 6899 | ||
6812 | return 0; | 6900 | return 0; |
6813 | } | 6901 | } |
@@ -6819,7 +6907,7 @@ static int nl80211_register_beacons(struct sk_buff *skb, struct genl_info *info) | |||
6819 | #define NL80211_FLAG_NEED_NETDEV_UP (NL80211_FLAG_NEED_NETDEV |\ | 6907 | #define NL80211_FLAG_NEED_NETDEV_UP (NL80211_FLAG_NEED_NETDEV |\ |
6820 | NL80211_FLAG_CHECK_NETDEV_UP) | 6908 | NL80211_FLAG_CHECK_NETDEV_UP) |
6821 | #define NL80211_FLAG_NEED_WDEV 0x10 | 6909 | #define NL80211_FLAG_NEED_WDEV 0x10 |
6822 | /* If a netdev is associated, it must be UP */ | 6910 | /* If a netdev is associated, it must be UP, P2P must be started */ |
6823 | #define NL80211_FLAG_NEED_WDEV_UP (NL80211_FLAG_NEED_WDEV |\ | 6911 | #define NL80211_FLAG_NEED_WDEV_UP (NL80211_FLAG_NEED_WDEV |\ |
6824 | NL80211_FLAG_CHECK_NETDEV_UP) | 6912 | NL80211_FLAG_CHECK_NETDEV_UP) |
6825 | 6913 | ||
@@ -6880,6 +6968,13 @@ static int nl80211_pre_doit(struct genl_ops *ops, struct sk_buff *skb, | |||
6880 | } | 6968 | } |
6881 | 6969 | ||
6882 | dev_hold(dev); | 6970 | dev_hold(dev); |
6971 | } else if (ops->internal_flags & NL80211_FLAG_CHECK_NETDEV_UP) { | ||
6972 | if (!wdev->p2p_started) { | ||
6973 | mutex_unlock(&cfg80211_mutex); | ||
6974 | if (rtnl) | ||
6975 | rtnl_unlock(); | ||
6976 | return -ENETDOWN; | ||
6977 | } | ||
6883 | } | 6978 | } |
6884 | 6979 | ||
6885 | cfg80211_lock_rdev(rdev); | 6980 | cfg80211_lock_rdev(rdev); |
@@ -7441,7 +7536,22 @@ static struct genl_ops nl80211_ops[] = { | |||
7441 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 7536 | .internal_flags = NL80211_FLAG_NEED_NETDEV | |
7442 | NL80211_FLAG_NEED_RTNL, | 7537 | NL80211_FLAG_NEED_RTNL, |
7443 | }, | 7538 | }, |
7444 | 7539 | { | |
7540 | .cmd = NL80211_CMD_START_P2P_DEVICE, | ||
7541 | .doit = nl80211_start_p2p_device, | ||
7542 | .policy = nl80211_policy, | ||
7543 | .flags = GENL_ADMIN_PERM, | ||
7544 | .internal_flags = NL80211_FLAG_NEED_WDEV | | ||
7545 | NL80211_FLAG_NEED_RTNL, | ||
7546 | }, | ||
7547 | { | ||
7548 | .cmd = NL80211_CMD_STOP_P2P_DEVICE, | ||
7549 | .doit = nl80211_stop_p2p_device, | ||
7550 | .policy = nl80211_policy, | ||
7551 | .flags = GENL_ADMIN_PERM, | ||
7552 | .internal_flags = NL80211_FLAG_NEED_WDEV_UP | | ||
7553 | NL80211_FLAG_NEED_RTNL, | ||
7554 | }, | ||
7445 | }; | 7555 | }; |
7446 | 7556 | ||
7447 | static struct genl_multicast_group nl80211_mlme_mcgrp = { | 7557 | static struct genl_multicast_group nl80211_mlme_mcgrp = { |
@@ -7520,12 +7630,12 @@ static int nl80211_add_scan_req(struct sk_buff *msg, | |||
7520 | static int nl80211_send_scan_msg(struct sk_buff *msg, | 7630 | static int nl80211_send_scan_msg(struct sk_buff *msg, |
7521 | struct cfg80211_registered_device *rdev, | 7631 | struct cfg80211_registered_device *rdev, |
7522 | struct wireless_dev *wdev, | 7632 | struct wireless_dev *wdev, |
7523 | u32 pid, u32 seq, int flags, | 7633 | u32 portid, u32 seq, int flags, |
7524 | u32 cmd) | 7634 | u32 cmd) |
7525 | { | 7635 | { |
7526 | void *hdr; | 7636 | void *hdr; |
7527 | 7637 | ||
7528 | hdr = nl80211hdr_put(msg, pid, seq, flags, cmd); | 7638 | hdr = nl80211hdr_put(msg, portid, seq, flags, cmd); |
7529 | if (!hdr) | 7639 | if (!hdr) |
7530 | return -1; | 7640 | return -1; |
7531 | 7641 | ||
@@ -7549,11 +7659,11 @@ static int | |||
7549 | nl80211_send_sched_scan_msg(struct sk_buff *msg, | 7659 | nl80211_send_sched_scan_msg(struct sk_buff *msg, |
7550 | struct cfg80211_registered_device *rdev, | 7660 | struct cfg80211_registered_device *rdev, |
7551 | struct net_device *netdev, | 7661 | struct net_device *netdev, |
7552 | u32 pid, u32 seq, int flags, u32 cmd) | 7662 | u32 portid, u32 seq, int flags, u32 cmd) |
7553 | { | 7663 | { |
7554 | void *hdr; | 7664 | void *hdr; |
7555 | 7665 | ||
7556 | hdr = nl80211hdr_put(msg, pid, seq, flags, cmd); | 7666 | hdr = nl80211hdr_put(msg, portid, seq, flags, cmd); |
7557 | if (!hdr) | 7667 | if (!hdr) |
7558 | return -1; | 7668 | return -1; |
7559 | 7669 | ||
@@ -8254,6 +8364,40 @@ void nl80211_send_sta_del_event(struct cfg80211_registered_device *rdev, | |||
8254 | nlmsg_free(msg); | 8364 | nlmsg_free(msg); |
8255 | } | 8365 | } |
8256 | 8366 | ||
8367 | void nl80211_send_conn_failed_event(struct cfg80211_registered_device *rdev, | ||
8368 | struct net_device *dev, const u8 *mac_addr, | ||
8369 | enum nl80211_connect_failed_reason reason, | ||
8370 | gfp_t gfp) | ||
8371 | { | ||
8372 | struct sk_buff *msg; | ||
8373 | void *hdr; | ||
8374 | |||
8375 | msg = nlmsg_new(NLMSG_GOODSIZE, gfp); | ||
8376 | if (!msg) | ||
8377 | return; | ||
8378 | |||
8379 | hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_CONN_FAILED); | ||
8380 | if (!hdr) { | ||
8381 | nlmsg_free(msg); | ||
8382 | return; | ||
8383 | } | ||
8384 | |||
8385 | if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || | ||
8386 | nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr) || | ||
8387 | nla_put_u32(msg, NL80211_ATTR_CONN_FAILED_REASON, reason)) | ||
8388 | goto nla_put_failure; | ||
8389 | |||
8390 | genlmsg_end(msg, hdr); | ||
8391 | |||
8392 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, | ||
8393 | nl80211_mlme_mcgrp.id, gfp); | ||
8394 | return; | ||
8395 | |||
8396 | nla_put_failure: | ||
8397 | genlmsg_cancel(msg, hdr); | ||
8398 | nlmsg_free(msg); | ||
8399 | } | ||
8400 | |||
8257 | static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd, | 8401 | static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd, |
8258 | const u8 *addr, gfp_t gfp) | 8402 | const u8 *addr, gfp_t gfp) |
8259 | { | 8403 | { |
@@ -8262,9 +8406,9 @@ static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd, | |||
8262 | struct sk_buff *msg; | 8406 | struct sk_buff *msg; |
8263 | void *hdr; | 8407 | void *hdr; |
8264 | int err; | 8408 | int err; |
8265 | u32 nlpid = ACCESS_ONCE(wdev->ap_unexpected_nlpid); | 8409 | u32 nlportid = ACCESS_ONCE(wdev->ap_unexpected_nlportid); |
8266 | 8410 | ||
8267 | if (!nlpid) | 8411 | if (!nlportid) |
8268 | return false; | 8412 | return false; |
8269 | 8413 | ||
8270 | msg = nlmsg_new(100, gfp); | 8414 | msg = nlmsg_new(100, gfp); |
@@ -8288,7 +8432,7 @@ static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd, | |||
8288 | return true; | 8432 | return true; |
8289 | } | 8433 | } |
8290 | 8434 | ||
8291 | genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlpid); | 8435 | genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); |
8292 | return true; | 8436 | return true; |
8293 | 8437 | ||
8294 | nla_put_failure: | 8438 | nla_put_failure: |
@@ -8312,7 +8456,7 @@ bool nl80211_unexpected_4addr_frame(struct net_device *dev, | |||
8312 | } | 8456 | } |
8313 | 8457 | ||
8314 | int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, | 8458 | int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, |
8315 | struct wireless_dev *wdev, u32 nlpid, | 8459 | struct wireless_dev *wdev, u32 nlportid, |
8316 | int freq, int sig_dbm, | 8460 | int freq, int sig_dbm, |
8317 | const u8 *buf, size_t len, gfp_t gfp) | 8461 | const u8 *buf, size_t len, gfp_t gfp) |
8318 | { | 8462 | { |
@@ -8341,7 +8485,7 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, | |||
8341 | 8485 | ||
8342 | genlmsg_end(msg, hdr); | 8486 | genlmsg_end(msg, hdr); |
8343 | 8487 | ||
8344 | return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlpid); | 8488 | return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); |
8345 | 8489 | ||
8346 | nla_put_failure: | 8490 | nla_put_failure: |
8347 | genlmsg_cancel(msg, hdr); | 8491 | genlmsg_cancel(msg, hdr); |
@@ -8696,9 +8840,9 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy, | |||
8696 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 8840 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
8697 | struct sk_buff *msg; | 8841 | struct sk_buff *msg; |
8698 | void *hdr; | 8842 | void *hdr; |
8699 | u32 nlpid = ACCESS_ONCE(rdev->ap_beacons_nlpid); | 8843 | u32 nlportid = ACCESS_ONCE(rdev->ap_beacons_nlportid); |
8700 | 8844 | ||
8701 | if (!nlpid) | 8845 | if (!nlportid) |
8702 | return; | 8846 | return; |
8703 | 8847 | ||
8704 | msg = nlmsg_new(len + 100, gfp); | 8848 | msg = nlmsg_new(len + 100, gfp); |
@@ -8721,7 +8865,7 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy, | |||
8721 | 8865 | ||
8722 | genlmsg_end(msg, hdr); | 8866 | genlmsg_end(msg, hdr); |
8723 | 8867 | ||
8724 | genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlpid); | 8868 | genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); |
8725 | return; | 8869 | return; |
8726 | 8870 | ||
8727 | nla_put_failure: | 8871 | nla_put_failure: |
@@ -8745,9 +8889,9 @@ static int nl80211_netlink_notify(struct notifier_block * nb, | |||
8745 | 8889 | ||
8746 | list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) { | 8890 | list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) { |
8747 | list_for_each_entry_rcu(wdev, &rdev->wdev_list, list) | 8891 | list_for_each_entry_rcu(wdev, &rdev->wdev_list, list) |
8748 | cfg80211_mlme_unregister_socket(wdev, notify->pid); | 8892 | cfg80211_mlme_unregister_socket(wdev, notify->portid); |
8749 | if (rdev->ap_beacons_nlpid == notify->pid) | 8893 | if (rdev->ap_beacons_nlportid == notify->portid) |
8750 | rdev->ap_beacons_nlpid = 0; | 8894 | rdev->ap_beacons_nlportid = 0; |
8751 | } | 8895 | } |
8752 | 8896 | ||
8753 | rcu_read_unlock(); | 8897 | rcu_read_unlock(); |