Commit 092008ab authored by Janusz Dziedzic's avatar Janusz Dziedzic Committed by Johannes Berg

cfg80211: regulatory: reset regdomain in case of error

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: default avatarJanusz Dziedzic <janusz.dziedzic@tieto.com>
Acked-by: default avatarLuis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 963a1852
...@@ -2373,6 +2373,7 @@ static int reg_set_rd_country_ie(const struct ieee80211_regdomain *rd, ...@@ -2373,6 +2373,7 @@ static int reg_set_rd_country_ie(const struct ieee80211_regdomain *rd,
int set_regdom(const struct ieee80211_regdomain *rd) int set_regdom(const struct ieee80211_regdomain *rd)
{ {
struct regulatory_request *lr; struct regulatory_request *lr;
bool user_reset = false;
int r; int r;
if (!reg_is_valid_request(rd->alpha2)) { if (!reg_is_valid_request(rd->alpha2)) {
...@@ -2389,6 +2390,7 @@ int set_regdom(const struct ieee80211_regdomain *rd) ...@@ -2389,6 +2390,7 @@ int set_regdom(const struct ieee80211_regdomain *rd)
break; break;
case NL80211_REGDOM_SET_BY_USER: case NL80211_REGDOM_SET_BY_USER:
r = reg_set_rd_user(rd, lr); r = reg_set_rd_user(rd, lr);
user_reset = true;
break; break;
case NL80211_REGDOM_SET_BY_DRIVER: case NL80211_REGDOM_SET_BY_DRIVER:
r = reg_set_rd_driver(rd, lr); r = reg_set_rd_driver(rd, lr);
...@@ -2402,8 +2404,14 @@ int set_regdom(const struct ieee80211_regdomain *rd) ...@@ -2402,8 +2404,14 @@ int set_regdom(const struct ieee80211_regdomain *rd)
} }
if (r) { if (r) {
if (r == -EALREADY) switch (r) {
case -EALREADY:
reg_set_request_processed(); reg_set_request_processed();
break;
default:
/* Back to world regulatory in case of errors */
restore_regulatory_settings(user_reset);
}
kfree(rd); kfree(rd);
return r; return r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment