Skip to content

Commit

Permalink
cfg80211: regulatory: reset regdomain in case of error
Browse files Browse the repository at this point in the history
Reset regdomain to world regdomain in case
of errors in set_regdom() function.

This will fix a problem with such scenario:
- iw reg set US
- iw reg set 00
- iw reg set US
The last step always fail and we get deadlock
in kernel regulatory code. Next setting new
regulatory wasn't possible due to:

Pending regulatory request, waiting for it to be processed...

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Janusz Dziedzic authored and Johannes Berg committed Feb 25, 2014
1 parent 963a185 commit 092008a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion net/wireless/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2373,6 +2373,7 @@ static int reg_set_rd_country_ie(const struct ieee80211_regdomain *rd,
int set_regdom(const struct ieee80211_regdomain *rd)
{
struct regulatory_request *lr;
bool user_reset = false;
int r;

if (!reg_is_valid_request(rd->alpha2)) {
Expand All @@ -2389,6 +2390,7 @@ int set_regdom(const struct ieee80211_regdomain *rd)
break;
case NL80211_REGDOM_SET_BY_USER:
r = reg_set_rd_user(rd, lr);
user_reset = true;
break;
case NL80211_REGDOM_SET_BY_DRIVER:
r = reg_set_rd_driver(rd, lr);
Expand All @@ -2402,8 +2404,14 @@ int set_regdom(const struct ieee80211_regdomain *rd)
}

if (r) {
if (r == -EALREADY)
switch (r) {
case -EALREADY:
reg_set_request_processed();
break;
default:
/* Back to world regulatory in case of errors */
restore_regulatory_settings(user_reset);
}

kfree(rd);
return r;
Expand Down

0 comments on commit 092008a

Please sign in to comment.