lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+icZUXqtz5CbuC_gOMgJRCuLbsnSO0gsB7zS0ZwMQW3PBOCAw@mail.gmail.com>
Date:   Sat, 25 Dec 2021 19:23:19 +0100
From:   Sedat Dilek <sedat.dilek@...il.com>
To:     Sasha Levin <sashal@...nel.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Finn Behrens <me@...enk.dev>, Finn Behrens <fin@...ntec.com>,
        Johannes Berg <johannes.berg@...el.com>, davem@...emloft.net,
        kuba@...nel.org, Johannes Berg <johannes@...solutions.net>,
        netdev@...r.kernel.org, linux-wireless@...r.kernel.org
Subject: Re: [PATCH AUTOSEL 5.15 07/29] nl80211: reset regdom when reloading regdb

On Tue, Dec 21, 2021 at 2:58 AM Sasha Levin <sashal@...nel.org> wrote:
>
> From: Finn Behrens <me@...enk.dev>
>
> [ Upstream commit 1eda919126b420fee6b8d546f7f728fbbd4b8f11 ]
>
> Reload the regdom when the regulatory db is reloaded.
> Otherwise, the user had to change the regulatoy domain
> to a different one and then reset it to the correct
> one to have a new regulatory db take effect after a
> reload.
>
> Signed-off-by: Finn Behrens <fin@...ntec.com>
> Link: https://lore.kernel.org/r/YaIIZfxHgqc/UTA7@gimli.kloenk.dev
> [edit commit message]
> Signed-off-by: Johannes Berg <johannes.berg@...el.com>
> Signed-off-by: Sasha Levin <sashal@...nel.org>

This requires [1] to fix this warning:

net/wireless/reg.c:1137:23: warning: implicit conversion from
enumeration type 'enum nl80211_user_reg_hint_type' to different
enumeration type 'enum nl80211_reg_
initiator' [-Wenum-conversion]

[PATCH] nl80211: remove reload flag from regulatory_request

- Sedat -

[1] https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git/patch/?id=37d33114240ede043c42463a6347f68ed72d6904

> ---
>  include/net/regulatory.h |  1 +
>  net/wireless/reg.c       | 27 +++++++++++++++++++++++++--
>  2 files changed, 26 insertions(+), 2 deletions(-)
>
> diff --git a/include/net/regulatory.h b/include/net/regulatory.h
> index 47f06f6f5a67c..0cf9335431e07 100644
> --- a/include/net/regulatory.h
> +++ b/include/net/regulatory.h
> @@ -83,6 +83,7 @@ struct regulatory_request {
>         enum nl80211_dfs_regions dfs_region;
>         bool intersect;
>         bool processed;
> +       bool reload;
>         enum environment_cap country_ie_env;
>         struct list_head list;
>  };
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> index df87c7f3a0492..61f1bf1bc4a73 100644
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -133,6 +133,7 @@ static u32 reg_is_indoor_portid;
>
>  static void restore_regulatory_settings(bool reset_user, bool cached);
>  static void print_regdomain(const struct ieee80211_regdomain *rd);
> +static void reg_process_hint(struct regulatory_request *reg_request);
>
>  static const struct ieee80211_regdomain *get_cfg80211_regdom(void)
>  {
> @@ -1098,6 +1099,8 @@ int reg_reload_regdb(void)
>         const struct firmware *fw;
>         void *db;
>         int err;
> +       const struct ieee80211_regdomain *current_regdomain;
> +       struct regulatory_request *request;
>
>         err = request_firmware(&fw, "regulatory.db", &reg_pdev->dev);
>         if (err)
> @@ -1118,8 +1121,27 @@ int reg_reload_regdb(void)
>         if (!IS_ERR_OR_NULL(regdb))
>                 kfree(regdb);
>         regdb = db;
> -       rtnl_unlock();
>
> +       /* reset regulatory domain */
> +       current_regdomain = get_cfg80211_regdom();
> +
> +       request = kzalloc(sizeof(*request), GFP_KERNEL);
> +       if (!request) {
> +               err = -ENOMEM;
> +               goto out_unlock;
> +       }
> +
> +       request->wiphy_idx = WIPHY_IDX_INVALID;
> +       request->alpha2[0] = current_regdomain->alpha2[0];
> +       request->alpha2[1] = current_regdomain->alpha2[1];
> +       request->initiator = NL80211_USER_REG_HINT_USER;
> +       request->user_reg_hint_type = NL80211_USER_REG_HINT_USER;
> +       request->reload = true;
> +
> +       reg_process_hint(request);
> +
> +out_unlock:
> +       rtnl_unlock();
>   out:
>         release_firmware(fw);
>         return err;
> @@ -2690,7 +2712,8 @@ reg_process_hint_user(struct regulatory_request *user_request)
>
>         treatment = __reg_process_hint_user(user_request);
>         if (treatment == REG_REQ_IGNORE ||
> -           treatment == REG_REQ_ALREADY_SET)
> +           (treatment == REG_REQ_ALREADY_SET &&
> +            !user_request->reload))
>                 return REG_REQ_IGNORE;
>
>         user_request->intersect = treatment == REG_REQ_INTERSECT;
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ