diff options
author | John W. Linville <linville@tuxdriver.com> | 2013-06-21 15:42:30 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-06-21 15:42:30 -0400 |
commit | 7d2a47aab2a511c87a96238977e04e6378969d45 (patch) | |
tree | e3765af6d4b292d8f3c013a5962324eab683a931 /net/wireless/nl80211.c | |
parent | fedaf4ffc224a194e2d13a3ec2abe5df0bc94258 (diff) | |
parent | b887664d882ee4f6a67e0bf05e5f141d32fcc067 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts:
net/wireless/nl80211.c
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 187 |
1 files changed, 94 insertions, 93 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index ea74b9dd9d82..e545023e2871 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -800,12 +800,9 @@ static int nl80211_key_allowed(struct wireless_dev *wdev) | |||
800 | case NL80211_IFTYPE_MESH_POINT: | 800 | case NL80211_IFTYPE_MESH_POINT: |
801 | break; | 801 | break; |
802 | case NL80211_IFTYPE_ADHOC: | 802 | case NL80211_IFTYPE_ADHOC: |
803 | if (!wdev->current_bss) | ||
804 | return -ENOLINK; | ||
805 | break; | ||
806 | case NL80211_IFTYPE_STATION: | 803 | case NL80211_IFTYPE_STATION: |
807 | case NL80211_IFTYPE_P2P_CLIENT: | 804 | case NL80211_IFTYPE_P2P_CLIENT: |
808 | if (wdev->sme_state != CFG80211_SME_CONNECTED) | 805 | if (!wdev->current_bss) |
809 | return -ENOLINK; | 806 | return -ENOLINK; |
810 | break; | 807 | break; |
811 | default: | 808 | default: |
@@ -908,7 +905,7 @@ nla_put_failure: | |||
908 | static int nl80211_send_wowlan_tcp_caps(struct cfg80211_registered_device *rdev, | 905 | static int nl80211_send_wowlan_tcp_caps(struct cfg80211_registered_device *rdev, |
909 | struct sk_buff *msg) | 906 | struct sk_buff *msg) |
910 | { | 907 | { |
911 | const struct wiphy_wowlan_tcp_support *tcp = rdev->wiphy.wowlan.tcp; | 908 | const struct wiphy_wowlan_tcp_support *tcp = rdev->wiphy.wowlan->tcp; |
912 | struct nlattr *nl_tcp; | 909 | struct nlattr *nl_tcp; |
913 | 910 | ||
914 | if (!tcp) | 911 | if (!tcp) |
@@ -951,37 +948,37 @@ static int nl80211_send_wowlan(struct sk_buff *msg, | |||
951 | { | 948 | { |
952 | struct nlattr *nl_wowlan; | 949 | struct nlattr *nl_wowlan; |
953 | 950 | ||
954 | if (!dev->wiphy.wowlan.flags && !dev->wiphy.wowlan.n_patterns) | 951 | if (!dev->wiphy.wowlan) |
955 | return 0; | 952 | return 0; |
956 | 953 | ||
957 | nl_wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED); | 954 | nl_wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED); |
958 | if (!nl_wowlan) | 955 | if (!nl_wowlan) |
959 | return -ENOBUFS; | 956 | return -ENOBUFS; |
960 | 957 | ||
961 | if (((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_ANY) && | 958 | if (((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_ANY) && |
962 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_ANY)) || | 959 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_ANY)) || |
963 | ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_DISCONNECT) && | 960 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_DISCONNECT) && |
964 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) || | 961 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) || |
965 | ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_MAGIC_PKT) && | 962 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_MAGIC_PKT) && |
966 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) || | 963 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) || |
967 | ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY) && | 964 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY) && |
968 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED)) || | 965 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED)) || |
969 | ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && | 966 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && |
970 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) || | 967 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) || |
971 | ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ) && | 968 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ) && |
972 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST)) || | 969 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST)) || |
973 | ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_4WAY_HANDSHAKE) && | 970 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_4WAY_HANDSHAKE) && |
974 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE)) || | 971 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE)) || |
975 | ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_RFKILL_RELEASE) && | 972 | ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_RFKILL_RELEASE) && |
976 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE))) | 973 | nla_put_flag(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE))) |
977 | return -ENOBUFS; | 974 | return -ENOBUFS; |
978 | 975 | ||
979 | if (dev->wiphy.wowlan.n_patterns) { | 976 | if (dev->wiphy.wowlan->n_patterns) { |
980 | struct nl80211_wowlan_pattern_support pat = { | 977 | struct nl80211_wowlan_pattern_support pat = { |
981 | .max_patterns = dev->wiphy.wowlan.n_patterns, | 978 | .max_patterns = dev->wiphy.wowlan->n_patterns, |
982 | .min_pattern_len = dev->wiphy.wowlan.pattern_min_len, | 979 | .min_pattern_len = dev->wiphy.wowlan->pattern_min_len, |
983 | .max_pattern_len = dev->wiphy.wowlan.pattern_max_len, | 980 | .max_pattern_len = dev->wiphy.wowlan->pattern_max_len, |
984 | .max_pkt_offset = dev->wiphy.wowlan.max_pkt_offset, | 981 | .max_pkt_offset = dev->wiphy.wowlan->max_pkt_offset, |
985 | }; | 982 | }; |
986 | 983 | ||
987 | if (nla_put(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN, | 984 | if (nla_put(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN, |
@@ -3986,10 +3983,10 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) | |||
3986 | params.listen_interval = | 3983 | params.listen_interval = |
3987 | nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); | 3984 | nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); |
3988 | 3985 | ||
3989 | if (info->attrs[NL80211_ATTR_STA_AID]) | 3986 | if (info->attrs[NL80211_ATTR_PEER_AID]) |
3990 | params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); | ||
3991 | else | ||
3992 | params.aid = nla_get_u16(info->attrs[NL80211_ATTR_PEER_AID]); | 3987 | params.aid = nla_get_u16(info->attrs[NL80211_ATTR_PEER_AID]); |
3988 | else | ||
3989 | params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); | ||
3993 | if (!params.aid || params.aid > IEEE80211_MAX_AID) | 3990 | if (!params.aid || params.aid > IEEE80211_MAX_AID) |
3994 | return -EINVAL; | 3991 | return -EINVAL; |
3995 | 3992 | ||
@@ -4041,7 +4038,8 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) | |||
4041 | params.sta_modify_mask &= ~STATION_PARAM_APPLY_UAPSD; | 4038 | params.sta_modify_mask &= ~STATION_PARAM_APPLY_UAPSD; |
4042 | 4039 | ||
4043 | /* TDLS peers cannot be added */ | 4040 | /* TDLS peers cannot be added */ |
4044 | if (params.sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) | 4041 | if ((params.sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) || |
4042 | info->attrs[NL80211_ATTR_PEER_AID]) | ||
4045 | return -EINVAL; | 4043 | return -EINVAL; |
4046 | /* but don't bother the driver with it */ | 4044 | /* but don't bother the driver with it */ |
4047 | params.sta_flags_mask &= ~BIT(NL80211_STA_FLAG_TDLS_PEER); | 4045 | params.sta_flags_mask &= ~BIT(NL80211_STA_FLAG_TDLS_PEER); |
@@ -4067,7 +4065,8 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) | |||
4067 | if (params.sta_flags_mask & BIT(NL80211_STA_FLAG_ASSOCIATED)) | 4065 | if (params.sta_flags_mask & BIT(NL80211_STA_FLAG_ASSOCIATED)) |
4068 | return -EINVAL; | 4066 | return -EINVAL; |
4069 | /* TDLS peers cannot be added */ | 4067 | /* TDLS peers cannot be added */ |
4070 | if (params.sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) | 4068 | if ((params.sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) || |
4069 | info->attrs[NL80211_ATTR_PEER_AID]) | ||
4071 | return -EINVAL; | 4070 | return -EINVAL; |
4072 | break; | 4071 | break; |
4073 | case NL80211_IFTYPE_STATION: | 4072 | case NL80211_IFTYPE_STATION: |
@@ -4589,7 +4588,9 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, | |||
4589 | nla_put_u32(msg, NL80211_MESHCONF_POWER_MODE, | 4588 | nla_put_u32(msg, NL80211_MESHCONF_POWER_MODE, |
4590 | cur_params.power_mode) || | 4589 | cur_params.power_mode) || |
4591 | nla_put_u16(msg, NL80211_MESHCONF_AWAKE_WINDOW, | 4590 | nla_put_u16(msg, NL80211_MESHCONF_AWAKE_WINDOW, |
4592 | cur_params.dot11MeshAwakeWindowDuration)) | 4591 | cur_params.dot11MeshAwakeWindowDuration) || |
4592 | nla_put_u32(msg, NL80211_MESHCONF_PLINK_TIMEOUT, | ||
4593 | cur_params.plink_timeout)) | ||
4593 | goto nla_put_failure; | 4594 | goto nla_put_failure; |
4594 | nla_nest_end(msg, pinfoattr); | 4595 | nla_nest_end(msg, pinfoattr); |
4595 | genlmsg_end(msg, hdr); | 4596 | genlmsg_end(msg, hdr); |
@@ -4630,6 +4631,7 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A | |||
4630 | [NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL] = { .type = NLA_U16 }, | 4631 | [NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL] = { .type = NLA_U16 }, |
4631 | [NL80211_MESHCONF_POWER_MODE] = { .type = NLA_U32 }, | 4632 | [NL80211_MESHCONF_POWER_MODE] = { .type = NLA_U32 }, |
4632 | [NL80211_MESHCONF_AWAKE_WINDOW] = { .type = NLA_U16 }, | 4633 | [NL80211_MESHCONF_AWAKE_WINDOW] = { .type = NLA_U16 }, |
4634 | [NL80211_MESHCONF_PLINK_TIMEOUT] = { .type = NLA_U32 }, | ||
4633 | }; | 4635 | }; |
4634 | 4636 | ||
4635 | static const struct nla_policy | 4637 | static const struct nla_policy |
@@ -4767,6 +4769,9 @@ do { \ | |||
4767 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshAwakeWindowDuration, | 4769 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshAwakeWindowDuration, |
4768 | 0, 65535, mask, | 4770 | 0, 65535, mask, |
4769 | NL80211_MESHCONF_AWAKE_WINDOW, nla_get_u16); | 4771 | NL80211_MESHCONF_AWAKE_WINDOW, nla_get_u16); |
4772 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, plink_timeout, 1, 0xffffffff, | ||
4773 | mask, NL80211_MESHCONF_PLINK_TIMEOUT, | ||
4774 | nla_get_u32); | ||
4770 | if (mask_out) | 4775 | if (mask_out) |
4771 | *mask_out = mask; | 4776 | *mask_out = mask; |
4772 | 4777 | ||
@@ -7153,6 +7158,9 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
7153 | return -EOPNOTSUPP; | 7158 | return -EOPNOTSUPP; |
7154 | 7159 | ||
7155 | switch (wdev->iftype) { | 7160 | switch (wdev->iftype) { |
7161 | case NL80211_IFTYPE_P2P_DEVICE: | ||
7162 | if (!info->attrs[NL80211_ATTR_WIPHY_FREQ]) | ||
7163 | return -EINVAL; | ||
7156 | case NL80211_IFTYPE_STATION: | 7164 | case NL80211_IFTYPE_STATION: |
7157 | case NL80211_IFTYPE_ADHOC: | 7165 | case NL80211_IFTYPE_ADHOC: |
7158 | case NL80211_IFTYPE_P2P_CLIENT: | 7166 | case NL80211_IFTYPE_P2P_CLIENT: |
@@ -7160,7 +7168,6 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
7160 | case NL80211_IFTYPE_AP_VLAN: | 7168 | case NL80211_IFTYPE_AP_VLAN: |
7161 | case NL80211_IFTYPE_MESH_POINT: | 7169 | case NL80211_IFTYPE_MESH_POINT: |
7162 | case NL80211_IFTYPE_P2P_GO: | 7170 | case NL80211_IFTYPE_P2P_GO: |
7163 | case NL80211_IFTYPE_P2P_DEVICE: | ||
7164 | break; | 7171 | break; |
7165 | default: | 7172 | default: |
7166 | return -EOPNOTSUPP; | 7173 | return -EOPNOTSUPP; |
@@ -7188,9 +7195,18 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
7188 | 7195 | ||
7189 | no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); | 7196 | no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); |
7190 | 7197 | ||
7191 | err = nl80211_parse_chandef(rdev, info, &chandef); | 7198 | /* get the channel if any has been specified, otherwise pass NULL to |
7192 | if (err) | 7199 | * the driver. The latter will use the current one |
7193 | return err; | 7200 | */ |
7201 | chandef.chan = NULL; | ||
7202 | if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { | ||
7203 | err = nl80211_parse_chandef(rdev, info, &chandef); | ||
7204 | if (err) | ||
7205 | return err; | ||
7206 | } | ||
7207 | |||
7208 | if (!chandef.chan && offchan) | ||
7209 | return -EINVAL; | ||
7194 | 7210 | ||
7195 | if (!dont_wait_for_ack) { | 7211 | if (!dont_wait_for_ack) { |
7196 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 7212 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
@@ -7495,6 +7511,23 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) | |||
7495 | setup.chandef.chan = NULL; | 7511 | setup.chandef.chan = NULL; |
7496 | } | 7512 | } |
7497 | 7513 | ||
7514 | if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) { | ||
7515 | u8 *rates = nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); | ||
7516 | int n_rates = | ||
7517 | nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); | ||
7518 | struct ieee80211_supported_band *sband; | ||
7519 | |||
7520 | if (!setup.chandef.chan) | ||
7521 | return -EINVAL; | ||
7522 | |||
7523 | sband = rdev->wiphy.bands[setup.chandef.chan->band]; | ||
7524 | |||
7525 | err = ieee80211_get_ratemask(sband, rates, n_rates, | ||
7526 | &setup.basic_rates); | ||
7527 | if (err) | ||
7528 | return err; | ||
7529 | } | ||
7530 | |||
7498 | return cfg80211_join_mesh(rdev, dev, &setup, &cfg); | 7531 | return cfg80211_join_mesh(rdev, dev, &setup, &cfg); |
7499 | } | 7532 | } |
7500 | 7533 | ||
@@ -7591,8 +7624,7 @@ static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info) | |||
7591 | void *hdr; | 7624 | void *hdr; |
7592 | u32 size = NLMSG_DEFAULT_SIZE; | 7625 | u32 size = NLMSG_DEFAULT_SIZE; |
7593 | 7626 | ||
7594 | if (!rdev->wiphy.wowlan.flags && !rdev->wiphy.wowlan.n_patterns && | 7627 | if (!rdev->wiphy.wowlan) |
7595 | !rdev->wiphy.wowlan.tcp) | ||
7596 | return -EOPNOTSUPP; | 7628 | return -EOPNOTSUPP; |
7597 | 7629 | ||
7598 | if (rdev->wiphy.wowlan_config && rdev->wiphy.wowlan_config->tcp) { | 7630 | if (rdev->wiphy.wowlan_config && rdev->wiphy.wowlan_config->tcp) { |
@@ -7665,7 +7697,7 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev, | |||
7665 | u32 data_size, wake_size, tokens_size = 0, wake_mask_size; | 7697 | u32 data_size, wake_size, tokens_size = 0, wake_mask_size; |
7666 | int err, port; | 7698 | int err, port; |
7667 | 7699 | ||
7668 | if (!rdev->wiphy.wowlan.tcp) | 7700 | if (!rdev->wiphy.wowlan->tcp) |
7669 | return -EINVAL; | 7701 | return -EINVAL; |
7670 | 7702 | ||
7671 | err = nla_parse(tb, MAX_NL80211_WOWLAN_TCP, | 7703 | err = nla_parse(tb, MAX_NL80211_WOWLAN_TCP, |
@@ -7685,16 +7717,16 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev, | |||
7685 | return -EINVAL; | 7717 | return -EINVAL; |
7686 | 7718 | ||
7687 | data_size = nla_len(tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD]); | 7719 | data_size = nla_len(tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD]); |
7688 | if (data_size > rdev->wiphy.wowlan.tcp->data_payload_max) | 7720 | if (data_size > rdev->wiphy.wowlan->tcp->data_payload_max) |
7689 | return -EINVAL; | 7721 | return -EINVAL; |
7690 | 7722 | ||
7691 | if (nla_get_u32(tb[NL80211_WOWLAN_TCP_DATA_INTERVAL]) > | 7723 | if (nla_get_u32(tb[NL80211_WOWLAN_TCP_DATA_INTERVAL]) > |
7692 | rdev->wiphy.wowlan.tcp->data_interval_max || | 7724 | rdev->wiphy.wowlan->tcp->data_interval_max || |
7693 | nla_get_u32(tb[NL80211_WOWLAN_TCP_DATA_INTERVAL]) == 0) | 7725 | nla_get_u32(tb[NL80211_WOWLAN_TCP_DATA_INTERVAL]) == 0) |
7694 | return -EINVAL; | 7726 | return -EINVAL; |
7695 | 7727 | ||
7696 | wake_size = nla_len(tb[NL80211_WOWLAN_TCP_WAKE_PAYLOAD]); | 7728 | wake_size = nla_len(tb[NL80211_WOWLAN_TCP_WAKE_PAYLOAD]); |
7697 | if (wake_size > rdev->wiphy.wowlan.tcp->wake_payload_max) | 7729 | if (wake_size > rdev->wiphy.wowlan->tcp->wake_payload_max) |
7698 | return -EINVAL; | 7730 | return -EINVAL; |
7699 | 7731 | ||
7700 | wake_mask_size = nla_len(tb[NL80211_WOWLAN_TCP_WAKE_MASK]); | 7732 | wake_mask_size = nla_len(tb[NL80211_WOWLAN_TCP_WAKE_MASK]); |
@@ -7709,13 +7741,13 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev, | |||
7709 | 7741 | ||
7710 | if (!tok->len || tokens_size % tok->len) | 7742 | if (!tok->len || tokens_size % tok->len) |
7711 | return -EINVAL; | 7743 | return -EINVAL; |
7712 | if (!rdev->wiphy.wowlan.tcp->tok) | 7744 | if (!rdev->wiphy.wowlan->tcp->tok) |
7713 | return -EINVAL; | 7745 | return -EINVAL; |
7714 | if (tok->len > rdev->wiphy.wowlan.tcp->tok->max_len) | 7746 | if (tok->len > rdev->wiphy.wowlan->tcp->tok->max_len) |
7715 | return -EINVAL; | 7747 | return -EINVAL; |
7716 | if (tok->len < rdev->wiphy.wowlan.tcp->tok->min_len) | 7748 | if (tok->len < rdev->wiphy.wowlan->tcp->tok->min_len) |
7717 | return -EINVAL; | 7749 | return -EINVAL; |
7718 | if (tokens_size > rdev->wiphy.wowlan.tcp->tok->bufsize) | 7750 | if (tokens_size > rdev->wiphy.wowlan->tcp->tok->bufsize) |
7719 | return -EINVAL; | 7751 | return -EINVAL; |
7720 | if (tok->offset + tok->len > data_size) | 7752 | if (tok->offset + tok->len > data_size) |
7721 | return -EINVAL; | 7753 | return -EINVAL; |
@@ -7723,7 +7755,7 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev, | |||
7723 | 7755 | ||
7724 | if (tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ]) { | 7756 | if (tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ]) { |
7725 | seq = nla_data(tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ]); | 7757 | seq = nla_data(tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ]); |
7726 | if (!rdev->wiphy.wowlan.tcp->seq) | 7758 | if (!rdev->wiphy.wowlan->tcp->seq) |
7727 | return -EINVAL; | 7759 | return -EINVAL; |
7728 | if (seq->len == 0 || seq->len > 4) | 7760 | if (seq->len == 0 || seq->len > 4) |
7729 | return -EINVAL; | 7761 | return -EINVAL; |
@@ -7804,12 +7836,11 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) | |||
7804 | struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG]; | 7836 | struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG]; |
7805 | struct cfg80211_wowlan new_triggers = {}; | 7837 | struct cfg80211_wowlan new_triggers = {}; |
7806 | struct cfg80211_wowlan *ntrig; | 7838 | struct cfg80211_wowlan *ntrig; |
7807 | struct wiphy_wowlan_support *wowlan = &rdev->wiphy.wowlan; | 7839 | const struct wiphy_wowlan_support *wowlan = rdev->wiphy.wowlan; |
7808 | int err, i; | 7840 | int err, i; |
7809 | bool prev_enabled = rdev->wiphy.wowlan_config; | 7841 | bool prev_enabled = rdev->wiphy.wowlan_config; |
7810 | 7842 | ||
7811 | if (!rdev->wiphy.wowlan.flags && !rdev->wiphy.wowlan.n_patterns && | 7843 | if (!wowlan) |
7812 | !rdev->wiphy.wowlan.tcp) | ||
7813 | return -EOPNOTSUPP; | 7844 | return -EOPNOTSUPP; |
7814 | 7845 | ||
7815 | if (!info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) { | 7846 | if (!info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) { |
@@ -9326,31 +9357,27 @@ void nl80211_send_disassoc(struct cfg80211_registered_device *rdev, | |||
9326 | NL80211_CMD_DISASSOCIATE, gfp); | 9357 | NL80211_CMD_DISASSOCIATE, gfp); |
9327 | } | 9358 | } |
9328 | 9359 | ||
9329 | void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf, | 9360 | void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, const u8 *buf, |
9330 | size_t len) | 9361 | size_t len) |
9331 | { | 9362 | { |
9332 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 9363 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
9333 | struct wiphy *wiphy = wdev->wiphy; | 9364 | struct wiphy *wiphy = wdev->wiphy; |
9334 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 9365 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
9366 | const struct ieee80211_mgmt *mgmt = (void *)buf; | ||
9367 | u32 cmd; | ||
9335 | 9368 | ||
9336 | trace_cfg80211_send_unprot_deauth(dev); | 9369 | if (WARN_ON(len < 2)) |
9337 | nl80211_send_mlme_event(rdev, dev, buf, len, | 9370 | return; |
9338 | NL80211_CMD_UNPROT_DEAUTHENTICATE, GFP_ATOMIC); | ||
9339 | } | ||
9340 | EXPORT_SYMBOL(cfg80211_send_unprot_deauth); | ||
9341 | 9371 | ||
9342 | void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf, | 9372 | if (ieee80211_is_deauth(mgmt->frame_control)) |
9343 | size_t len) | 9373 | cmd = NL80211_CMD_UNPROT_DEAUTHENTICATE; |
9344 | { | 9374 | else |
9345 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 9375 | cmd = NL80211_CMD_UNPROT_DISASSOCIATE; |
9346 | struct wiphy *wiphy = wdev->wiphy; | ||
9347 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | ||
9348 | 9376 | ||
9349 | trace_cfg80211_send_unprot_disassoc(dev); | 9377 | trace_cfg80211_rx_unprot_mlme_mgmt(dev, buf, len); |
9350 | nl80211_send_mlme_event(rdev, dev, buf, len, | 9378 | nl80211_send_mlme_event(rdev, dev, buf, len, cmd, GFP_ATOMIC); |
9351 | NL80211_CMD_UNPROT_DISASSOCIATE, GFP_ATOMIC); | ||
9352 | } | 9379 | } |
9353 | EXPORT_SYMBOL(cfg80211_send_unprot_disassoc); | 9380 | EXPORT_SYMBOL(cfg80211_rx_unprot_mlme_mgmt); |
9354 | 9381 | ||
9355 | static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev, | 9382 | static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev, |
9356 | struct net_device *netdev, int cmd, | 9383 | struct net_device *netdev, int cmd, |
@@ -9861,7 +9888,6 @@ static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd, | |||
9861 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 9888 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); |
9862 | struct sk_buff *msg; | 9889 | struct sk_buff *msg; |
9863 | void *hdr; | 9890 | void *hdr; |
9864 | int err; | ||
9865 | u32 nlportid = ACCESS_ONCE(wdev->ap_unexpected_nlportid); | 9891 | u32 nlportid = ACCESS_ONCE(wdev->ap_unexpected_nlportid); |
9866 | 9892 | ||
9867 | if (!nlportid) | 9893 | if (!nlportid) |
@@ -9882,12 +9908,7 @@ static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd, | |||
9882 | nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr)) | 9908 | nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr)) |
9883 | goto nla_put_failure; | 9909 | goto nla_put_failure; |
9884 | 9910 | ||
9885 | err = genlmsg_end(msg, hdr); | 9911 | genlmsg_end(msg, hdr); |
9886 | if (err < 0) { | ||
9887 | nlmsg_free(msg); | ||
9888 | return true; | ||
9889 | } | ||
9890 | |||
9891 | genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); | 9912 | genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); |
9892 | return true; | 9913 | return true; |
9893 | 9914 | ||
@@ -10330,10 +10351,7 @@ nl80211_radar_notify(struct cfg80211_registered_device *rdev, | |||
10330 | if (nl80211_send_chandef(msg, chandef)) | 10351 | if (nl80211_send_chandef(msg, chandef)) |
10331 | goto nla_put_failure; | 10352 | goto nla_put_failure; |
10332 | 10353 | ||
10333 | if (genlmsg_end(msg, hdr) < 0) { | 10354 | genlmsg_end(msg, hdr); |
10334 | nlmsg_free(msg); | ||
10335 | return; | ||
10336 | } | ||
10337 | 10355 | ||
10338 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, | 10356 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, |
10339 | nl80211_mlme_mcgrp.id, gfp); | 10357 | nl80211_mlme_mcgrp.id, gfp); |
@@ -10399,7 +10417,6 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr, | |||
10399 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 10417 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); |
10400 | struct sk_buff *msg; | 10418 | struct sk_buff *msg; |
10401 | void *hdr; | 10419 | void *hdr; |
10402 | int err; | ||
10403 | 10420 | ||
10404 | trace_cfg80211_probe_status(dev, addr, cookie, acked); | 10421 | trace_cfg80211_probe_status(dev, addr, cookie, acked); |
10405 | 10422 | ||
@@ -10421,11 +10438,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr, | |||
10421 | (acked && nla_put_flag(msg, NL80211_ATTR_ACK))) | 10438 | (acked && nla_put_flag(msg, NL80211_ATTR_ACK))) |
10422 | goto nla_put_failure; | 10439 | goto nla_put_failure; |
10423 | 10440 | ||
10424 | err = genlmsg_end(msg, hdr); | 10441 | genlmsg_end(msg, hdr); |
10425 | if (err < 0) { | ||
10426 | nlmsg_free(msg); | ||
10427 | return; | ||
10428 | } | ||
10429 | 10442 | ||
10430 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, | 10443 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, |
10431 | nl80211_mlme_mcgrp.id, gfp); | 10444 | nl80211_mlme_mcgrp.id, gfp); |
@@ -10491,7 +10504,7 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, | |||
10491 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 10504 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); |
10492 | struct sk_buff *msg; | 10505 | struct sk_buff *msg; |
10493 | void *hdr; | 10506 | void *hdr; |
10494 | int err, size = 200; | 10507 | int size = 200; |
10495 | 10508 | ||
10496 | trace_cfg80211_report_wowlan_wakeup(wdev->wiphy, wdev, wakeup); | 10509 | trace_cfg80211_report_wowlan_wakeup(wdev->wiphy, wdev, wakeup); |
10497 | 10510 | ||
@@ -10577,9 +10590,7 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, | |||
10577 | nla_nest_end(msg, reasons); | 10590 | nla_nest_end(msg, reasons); |
10578 | } | 10591 | } |
10579 | 10592 | ||
10580 | err = genlmsg_end(msg, hdr); | 10593 | genlmsg_end(msg, hdr); |
10581 | if (err < 0) | ||
10582 | goto free_msg; | ||
10583 | 10594 | ||
10584 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, | 10595 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, |
10585 | nl80211_mlme_mcgrp.id, gfp); | 10596 | nl80211_mlme_mcgrp.id, gfp); |
@@ -10599,7 +10610,6 @@ void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, | |||
10599 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 10610 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); |
10600 | struct sk_buff *msg; | 10611 | struct sk_buff *msg; |
10601 | void *hdr; | 10612 | void *hdr; |
10602 | int err; | ||
10603 | 10613 | ||
10604 | trace_cfg80211_tdls_oper_request(wdev->wiphy, dev, peer, oper, | 10614 | trace_cfg80211_tdls_oper_request(wdev->wiphy, dev, peer, oper, |
10605 | reason_code); | 10615 | reason_code); |
@@ -10622,11 +10632,7 @@ void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, | |||
10622 | nla_put_u16(msg, NL80211_ATTR_REASON_CODE, reason_code))) | 10632 | nla_put_u16(msg, NL80211_ATTR_REASON_CODE, reason_code))) |
10623 | goto nla_put_failure; | 10633 | goto nla_put_failure; |
10624 | 10634 | ||
10625 | err = genlmsg_end(msg, hdr); | 10635 | genlmsg_end(msg, hdr); |
10626 | if (err < 0) { | ||
10627 | nlmsg_free(msg); | ||
10628 | return; | ||
10629 | } | ||
10630 | 10636 | ||
10631 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, | 10637 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, |
10632 | nl80211_mlme_mcgrp.id, gfp); | 10638 | nl80211_mlme_mcgrp.id, gfp); |
@@ -10684,7 +10690,6 @@ void cfg80211_ft_event(struct net_device *netdev, | |||
10684 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 10690 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
10685 | struct sk_buff *msg; | 10691 | struct sk_buff *msg; |
10686 | void *hdr; | 10692 | void *hdr; |
10687 | int err; | ||
10688 | 10693 | ||
10689 | trace_cfg80211_ft_event(wiphy, netdev, ft_event); | 10694 | trace_cfg80211_ft_event(wiphy, netdev, ft_event); |
10690 | 10695 | ||
@@ -10710,11 +10715,7 @@ void cfg80211_ft_event(struct net_device *netdev, | |||
10710 | nla_put(msg, NL80211_ATTR_IE_RIC, ft_event->ric_ies_len, | 10715 | nla_put(msg, NL80211_ATTR_IE_RIC, ft_event->ric_ies_len, |
10711 | ft_event->ric_ies); | 10716 | ft_event->ric_ies); |
10712 | 10717 | ||
10713 | err = genlmsg_end(msg, hdr); | 10718 | genlmsg_end(msg, hdr); |
10714 | if (err < 0) { | ||
10715 | nlmsg_free(msg); | ||
10716 | return; | ||
10717 | } | ||
10718 | 10719 | ||
10719 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, | 10720 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, |
10720 | nl80211_mlme_mcgrp.id, GFP_KERNEL); | 10721 | nl80211_mlme_mcgrp.id, GFP_KERNEL); |