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 <[email protected]>
---
net/wireless/reg.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index c80f20e..c4c3af1 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2504,6 +2504,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)) {
@@ -2520,6 +2521,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);
@@ -2533,8 +2535,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;
--
1.7.9.5
On Fri, 2014-02-14 at 08:54 +0100, Janusz Dziedzic wrote:
> Reset regdomain to world regdomain in case
> of errors in set_regdom() function.
Luis, please comment?
johannes
On Fri, 2014-02-14 at 08:54 +0100, Janusz Dziedzic wrote:
> Allow to set world regulatory domain in case of user
> request (iw reg set 00).
Applied both, I took the first one for 3.14 still.
johannes
Allow to set world regulatory domain in case of user
request (iw reg set 00).
Signed-off-by: Janusz Dziedzic <[email protected]>
---
net/wireless/reg.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index c4c3af1..9e2450b 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2373,9 +2373,6 @@ static int reg_set_rd_user(const struct ieee80211_regdomain *rd,
{
const struct ieee80211_regdomain *intersected_rd = NULL;
- if (is_world_regdom(rd->alpha2))
- return -EINVAL;
-
if (!regdom_changes(rd->alpha2))
return -EALREADY;
--
1.7.9.5
On Thu, Feb 13, 2014 at 11:54 PM, Janusz Dziedzic
<[email protected]> wrote:
> 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 <[email protected]>
Acked-by: Luis R. Rodriguez <[email protected]>
Luis