regulatory: use RCU in regulatory_hint_11d()
Since it just does a quick check of the last regulatory request, the function doesn't have to hold the reg mutex but can use RCU instead. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
1cdd59ce8d
commit
db2424c58e
@ -1715,20 +1715,18 @@ void regulatory_hint_11d(struct wiphy *wiphy, enum ieee80211_band band,
|
|||||||
{
|
{
|
||||||
char alpha2[2];
|
char alpha2[2];
|
||||||
enum environment_cap env = ENVIRON_ANY;
|
enum environment_cap env = ENVIRON_ANY;
|
||||||
struct regulatory_request *request, *lr;
|
struct regulatory_request *request = NULL, *lr;
|
||||||
|
|
||||||
mutex_lock(®_mutex);
|
|
||||||
lr = get_last_request();
|
|
||||||
|
|
||||||
if (unlikely(!lr))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
/* IE len must be evenly divisible by 2 */
|
/* IE len must be evenly divisible by 2 */
|
||||||
if (country_ie_len & 0x01)
|
if (country_ie_len & 0x01)
|
||||||
goto out;
|
return;
|
||||||
|
|
||||||
if (country_ie_len < IEEE80211_COUNTRY_IE_MIN_LEN)
|
if (country_ie_len < IEEE80211_COUNTRY_IE_MIN_LEN)
|
||||||
goto out;
|
return;
|
||||||
|
|
||||||
|
request = kzalloc(sizeof(*request), GFP_KERNEL);
|
||||||
|
if (!request)
|
||||||
|
return;
|
||||||
|
|
||||||
alpha2[0] = country_ie[0];
|
alpha2[0] = country_ie[0];
|
||||||
alpha2[1] = country_ie[1];
|
alpha2[1] = country_ie[1];
|
||||||
@ -1738,6 +1736,12 @@ void regulatory_hint_11d(struct wiphy *wiphy, enum ieee80211_band band,
|
|||||||
else if (country_ie[2] == 'O')
|
else if (country_ie[2] == 'O')
|
||||||
env = ENVIRON_OUTDOOR;
|
env = ENVIRON_OUTDOOR;
|
||||||
|
|
||||||
|
rcu_read_lock();
|
||||||
|
lr = get_last_request();
|
||||||
|
|
||||||
|
if (unlikely(!lr))
|
||||||
|
goto out;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We will run this only upon a successful connection on cfg80211.
|
* We will run this only upon a successful connection on cfg80211.
|
||||||
* We leave conflict resolution to the workqueue, where can hold
|
* We leave conflict resolution to the workqueue, where can hold
|
||||||
@ -1747,10 +1751,6 @@ void regulatory_hint_11d(struct wiphy *wiphy, enum ieee80211_band band,
|
|||||||
lr->wiphy_idx != WIPHY_IDX_INVALID)
|
lr->wiphy_idx != WIPHY_IDX_INVALID)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
|
|
||||||
if (!request)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
request->wiphy_idx = get_wiphy_idx(wiphy);
|
request->wiphy_idx = get_wiphy_idx(wiphy);
|
||||||
request->alpha2[0] = alpha2[0];
|
request->alpha2[0] = alpha2[0];
|
||||||
request->alpha2[1] = alpha2[1];
|
request->alpha2[1] = alpha2[1];
|
||||||
@ -1758,8 +1758,10 @@ void regulatory_hint_11d(struct wiphy *wiphy, enum ieee80211_band band,
|
|||||||
request->country_ie_env = env;
|
request->country_ie_env = env;
|
||||||
|
|
||||||
queue_regulatory_request(request);
|
queue_regulatory_request(request);
|
||||||
|
request = NULL;
|
||||||
out:
|
out:
|
||||||
mutex_unlock(®_mutex);
|
kfree(request);
|
||||||
|
rcu_read_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void restore_alpha2(char *alpha2, bool reset_user)
|
static void restore_alpha2(char *alpha2, bool reset_user)
|
||||||
|
Loading…
Reference in New Issue
Block a user