mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Diederik de Haas" <diederik@cknow-tech.com>
To: "François Roux" <franzelfranzel@gmail.com>,
	"Johannes Berg" <johannes@sipsolutions.net>
Cc: "Diederik de Haas" <diederik@cknow-tech.com>,
	"Emmanuel Grumbach" <emmanuel.grumbach@intel.com>,
	<linux-wireless@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] wifi: nl80211: don't WARN on a missing self-managed regdom
Date: Wed, 07 Oct 2026 14:33:37 +0200	[thread overview]
Message-ID: <DLYLXXBUOUF1.2KZNF19JFRFBW@cknow-tech.com> (raw)
In-Reply-To: <20261006161744.3804-1-franzelfranzel@gmail.com>

Hi François, 

On Tue Oct 6, 2026 at 6:17 PM CEST, François Roux wrote:
> nl80211_get_reg_do() has a WARN_ON() for a self-managed wiphy without a
> private regdomain. Userspace can trigger it with a plain
> NL80211_CMD_GET_REG request.
>
> Drivers can register such a wiphy first and set its regdomain later.
> ath12k, for example, calls ieee80211_register_hw() and only then applies
> the regdomain with ath12k_regd_update(). iwd queries the regdomain of a
> new wiphy as soon as it shows up, so it can hit that window at boot:
>
>   WARNING: net/wireless/nl80211.c:10828 at nl80211_get_reg_do+0x1d0/0x1fc [cfg80211], CPU#5: iwd/721
>   Call trace:
>    nl80211_get_reg_do+0x1d0/0x1fc [cfg80211] (P)
>    genl_family_rcv_msg_doit+0xd0/0x138
>    genl_rcv_msg+0x58/0xd4
>    netlink_rcv_skb+0x5c/0x140
>    genl_rcv+0x34/0x4c
>    netlink_unicast+0x31c/0x39c
>    netlink_sendmsg+0x188/0x400
>
> The same trace has been reported with an Intel BE200 (iwlwifi). The dump
> variant, nl80211_get_reg_dump(), already skips a wiphy without a
> regdomain without warning.
>
> Keep returning -EINVAL, but drop the WARN_ON(). The same change was
> posted in 2021 but was never applied.
>
> Seen on a Microsoft Surface Pro 11 (WCN7850, ath12k) in 3 of 4 boots
> with next-20260929.

Thanks for this patch :-)

I added it to my 7.3-rc6 based kernel and booted into it.
With that kernel but without this patch, I (still) got the stack trace
as I reported earlier. But with this patch applied, I only see the following
in dmesg when I start ``iwd.service``:

```sh
[   99.031552] ACPI: <n/a>: failed to evaluate _DSM bf0212f2-788f-c64d-a5b3-1f738e285ade rev:0 func:0 (0x1001)
[   99.619075] wlan0: authenticate with 20:05:b7:00:29:19 (local address=f8:cf:52:97:97:58)
[   99.619887] wlan0: send auth to 20:05:b7:00:29:19 (try 1/3)
[   99.622752] wlan0: authenticated
[   99.624881] wlan0: associate with 20:05:b7:00:29:19 (try 1/3)
[   99.627724] wlan0: RX AssocResp from 20:05:b7:00:29:19 (capab=0x111 status=0 aid=1)
[   99.631005] wlan0: associated
[   99.657741] wlan0: Limiting TX power to 20 (23 - 3) dBm as advertised by 20:05:b7:00:29:19
```

Thus no longer a stack trace. So feel free to include my

Tested-by: Diederik de Haas <diederik@cknow-tech.com>  # NanoPC-T6 LTS + Intel BE200NGW

Cheers,
  Diederik

> Fixes: 1bdd716cbcca ("cfg80211: return private regdom for self-managed devices")
> Reported-by: Diederik de Haas <diederik@cknow-tech.com>
> Closes: https://lore.kernel.org/all/DL5P72WYQVOQ.23G9D01OY3BAA@cknow-tech.com/
> Link: https://lore.kernel.org/all/iwlwifi.20210409123755.ba2ea961f4ae.I8fde32d3196e860efa3b4ec464c42194195b42ec@changeid/
> Assisted-by: LLM
> Signed-off-by: François Roux <franzelfranzel@gmail.com>
> ---
>  net/wireless/nl80211.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index a18240455..2589491af 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -10824,8 +10824,12 @@ static int nl80211_get_reg_do(struct sk_buff *skb, struct genl_info *info)
>  
>  		regdom = get_wiphy_regdom(wiphy);
>  
> -		/* a self-managed-reg device must have a private regdom */
> -		if (WARN_ON(!regdom && self_managed)) {
> +		/*
> +		 * A self-managed-reg device gets its private regdom from the
> +		 * driver, which may happen only after the wiphy is registered.
> +		 * Userspace can ask before that, so don't WARN.
> +		 */
> +		if (!regdom && self_managed) {
>  			err = -EINVAL;
>  			goto nla_put_failure_rcu;
>  		}
>
> base-commit: 6474fa070f2b8013b4b87350b775b8c3be6e8aac



  reply	other threads:[~2026-10-07 12:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 16:17 François Roux
2026-10-07 12:33 ` Diederik de Haas [this message]
2026-10-07 14:55 ` Johannes Berg
2026-10-07 15:18   ` Diederik de Haas
2026-10-07 15:20     ` Johannes Berg

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=DLYLXXBUOUF1.2KZNF19JFRFBW@cknow-tech.com \
    --to=diederik@cknow-tech.com \
    --cc=emmanuel.grumbach@intel.com \
    --cc=franzelfranzel@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®