diff options
author | John W. Linville <linville@tuxdriver.com> | 2012-12-06 14:58:41 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-12-06 14:58:41 -0500 |
commit | 403e16731ffddc097eae89f53f9a7b0f0c9769c4 (patch) | |
tree | 228d17985ad8ea22a7763457bf9641eb44781568 /drivers/net/wireless/mwifiex/sta_ioctl.c | |
parent | 55cb0797fa779e36f62876a8aa44cbf3984e8d59 (diff) | |
parent | da29d2a5780d80857773d7776b7603a449b0b6e0 (diff) |
Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next
Conflicts:
drivers/net/wireless/mwifiex/sta_ioctl.c
net/mac80211/scan.c
Diffstat (limited to 'drivers/net/wireless/mwifiex/sta_ioctl.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_ioctl.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 95e3ab531c93..cb682561c438 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -160,11 +160,21 @@ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, | |||
160 | { | 160 | { |
161 | int ret; | 161 | int ret; |
162 | u8 *beacon_ie; | 162 | u8 *beacon_ie; |
163 | size_t beacon_ie_len; | ||
163 | struct mwifiex_bss_priv *bss_priv = (void *)bss->priv; | 164 | struct mwifiex_bss_priv *bss_priv = (void *)bss->priv; |
164 | size_t beacon_ie_len = bss->len_information_elements; | 165 | const struct cfg80211_bss_ies *ies; |
166 | |||
167 | rcu_read_lock(); | ||
168 | ies = rcu_dereference(bss->ies); | ||
169 | if (WARN_ON(!ies)) { | ||
170 | /* should never happen */ | ||
171 | rcu_read_unlock(); | ||
172 | return -EINVAL; | ||
173 | } | ||
174 | beacon_ie = kmemdup(ies->data, ies->len, GFP_ATOMIC); | ||
175 | beacon_ie_len = ies->len; | ||
176 | rcu_read_unlock(); | ||
165 | 177 | ||
166 | beacon_ie = kmemdup(bss->information_elements, beacon_ie_len, | ||
167 | GFP_KERNEL); | ||
168 | if (!beacon_ie) { | 178 | if (!beacon_ie) { |
169 | dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n"); | 179 | dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n"); |
170 | return -ENOMEM; | 180 | return -ENOMEM; |
@@ -199,18 +209,23 @@ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, | |||
199 | static int mwifiex_process_country_ie(struct mwifiex_private *priv, | 209 | static int mwifiex_process_country_ie(struct mwifiex_private *priv, |
200 | struct cfg80211_bss *bss) | 210 | struct cfg80211_bss *bss) |
201 | { | 211 | { |
202 | u8 *country_ie, country_ie_len; | 212 | const u8 *country_ie; |
213 | u8 country_ie_len; | ||
203 | struct mwifiex_802_11d_domain_reg *domain_info = | 214 | struct mwifiex_802_11d_domain_reg *domain_info = |
204 | &priv->adapter->domain_reg; | 215 | &priv->adapter->domain_reg; |
205 | 216 | ||
206 | country_ie = (u8 *)ieee80211_bss_get_ie(bss, WLAN_EID_COUNTRY); | 217 | rcu_read_lock(); |
207 | 218 | country_ie = ieee80211_bss_get_ie(bss, WLAN_EID_COUNTRY); | |
208 | if (!country_ie) | 219 | if (!country_ie) { |
220 | rcu_read_unlock(); | ||
209 | return 0; | 221 | return 0; |
222 | } | ||
210 | 223 | ||
211 | country_ie_len = country_ie[1]; | 224 | country_ie_len = country_ie[1]; |
212 | if (country_ie_len < IEEE80211_COUNTRY_IE_MIN_LEN) | 225 | if (country_ie_len < IEEE80211_COUNTRY_IE_MIN_LEN) { |
226 | rcu_read_unlock(); | ||
213 | return 0; | 227 | return 0; |
228 | } | ||
214 | 229 | ||
215 | domain_info->country_code[0] = country_ie[2]; | 230 | domain_info->country_code[0] = country_ie[2]; |
216 | domain_info->country_code[1] = country_ie[3]; | 231 | domain_info->country_code[1] = country_ie[3]; |
@@ -224,6 +239,8 @@ static int mwifiex_process_country_ie(struct mwifiex_private *priv, | |||
224 | memcpy((u8 *)domain_info->triplet, | 239 | memcpy((u8 *)domain_info->triplet, |
225 | &country_ie[2] + IEEE80211_COUNTRY_STRING_LEN, country_ie_len); | 240 | &country_ie[2] + IEEE80211_COUNTRY_STRING_LEN, country_ie_len); |
226 | 241 | ||
242 | rcu_read_unlock(); | ||
243 | |||
227 | if (mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11D_DOMAIN_INFO, | 244 | if (mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11D_DOMAIN_INFO, |
228 | HostCmd_ACT_GEN_SET, 0, NULL)) { | 245 | HostCmd_ACT_GEN_SET, 0, NULL)) { |
229 | wiphy_err(priv->adapter->wiphy, | 246 | wiphy_err(priv->adapter->wiphy, |