All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Finn Behrens <fin@nyantec.com>, linux-wireless@vger.kernel.org
Subject: Re: [PATCH v2] nl80211: reset regdom when reloading regdb
Date: Fri, 04 Dec 2020 12:39:29 +0100	[thread overview]
Message-ID: <10344296be9a9e4f6f30eb2adf6fa5a3263811cc.camel@sipsolutions.net> (raw)
In-Reply-To: <X7+F/ht8T7aGiIl7@bombur.kloenk.de> (sfid-20201126_114222_031269_4F737E8B)

On Thu, 2020-11-26 at 11:39 +0100, Finn Behrens wrote:
> reset the regdom when NL80211_CMD_RELOAD_REGDB is send

Please add a bit more commit message, saying why this is needed.

>  	err = request_firmware(&fw, "regulatory.db", &reg_pdev->dev);
> -	if (err)
> +	if (err) {
> +		pr_info("failed to load regulatory.db\n");
>  		return err;
> +	}
>  
>  	if (!valid_regdb(fw->data, fw->size)) {
> +		pr_info("loaded regulatory.db is malformed or signature is missing/invalid\n");
>  		err = -ENODATA;
>  		goto out;
>  	}

These changes seem unrelated.

> @@ -1101,6 +1105,28 @@ int reg_reload_regdb(void)
>  	regdb = db;
>  	rtnl_unlock();
>  
> +	// reset regulatory

For whatever reason, the kernel doesn't use C99 comments.

> +	const struct ieee80211_regdomain *current_regdomain = NULL;

This should've given you a compiler warning that you shouldn't declare
variables in the middle of the code.

> +	current_regdomain = get_cfg80211_regdom();
> +
> +	struct regulatory_request *request = NULL;
> +
> +	request = kzalloc(sizeof(*request), GFP_KERNEL);
> +	if (!request) {
> +		err = -ENOMEM;
> +		goto out;
> +	}
> +
> +	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;
> +
> +	queue_regulatory_request(request);
> 
Why does it even need to be queued - we're in a process context where we
can sleep?

johannes


  parent reply	other threads:[~2020-12-04 11:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-21 12:45 [PATCH] nl80211: reset regdom when reloading regdb Finn Behrens
2020-11-26 10:39 ` [PATCH v2] " Finn Behrens
2020-11-26 12:58   ` kernel test robot
2020-11-26 12:58     ` kernel test robot
2020-12-04 11:39   ` Johannes Berg [this message]
2021-11-13 10:54   ` [PATCH v4] " Finn Behrens
2021-11-26 12:08     ` Johannes Berg
2021-11-27 10:28     ` [PATCH v5] " Finn Behrens
2021-11-30 16:02       ` Nathan Chancellor
2021-11-30 16:50         ` Finn Behrens
2021-11-30 18:32           ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10344296be9a9e4f6f30eb2adf6fa5a3263811cc.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=fin@nyantec.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.