Skip to content

wifi: mt7932: skip a country-package pass that a newer request superseded - #205

Merged
RyanTheTide merged 1 commit into
aurora-wipfrom
fix/mt7932-stale-policy-pass
Oct 8, 2026
Merged

RyanTheTide merged 1 commit into
aurora-wipfrom
fix/mt7932-stale-policy-pass

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

A follow-up to #204 from its post-merge review. One commit.

What

mt_policy_disable() now checks, under RTNL, that the regulatory generation it was started for is still current. If a newer request has arrived, it leaves cfg80211's channel list alone and lets the newer pass apply its own country package.

Why

The startup work applied the country package's channel disables before it checked whether its request was still current:

  1. A second country change arrives while the work is loading the first country's package.
  2. cfg80211 has already recomputed the channel flags for the second country.
  3. The stale pass disables the first country's forbidden channels on top of those flags.
  4. The next pass adds the second country's own disables, and the union stays until the following regulatory change.

The result is only ever more restrictive than intended, so it is not a compliance problem. The boot sequence (world, then the configured country) cannot hit it, because the world package forbids nothing. But a user who changes country twice in quick succession loses channels the final country permits.

The regulatory notifier runs under RTNL, after cfg80211's recompute, and starts the new generation there, so a check under RTNL is stable against it. The generation also advances when a retired scan completes while a regulatory update is pending. That case re-runs the same request, so skipping only moves the same disables to the next pass, which applies them before anything is published.

Not changed: the notifier's no-change early return still compares the snapshot taken before the package filter. The review found no path on the J700 that reaches it; it is left for a separate change.

Fixes: 6e3838e91a3b ("wifi: mt7932: honour the channel permissions of the country package")

Testing

Hardware-tested on the MacBook Neo (J700), kernel 7.1.12-aurora-j700-fu1+ (all seven follow-ups merged onto aurora-wip 35c7d87), compared item for item with the default kernel built from that base: a country change AU→US→AU applied the US then the AU country package in order, the 5 GHz link to the access point held throughout, and 20/20 gateway pings followed; no driver warnings. The superseded-request race itself (two country changes in quick succession) is covered by review only. No effect on the M1/M2 configuration (the driver is not built there).

  • Builds, W=1 on the touched directories, then a full Image + modules + dtbs, on two configurations:
    • the J700 configuration with arch/arm64/configs/j700-radio.config;
    • arm64 defconfig + asahi.config with every Apple Silicon driver as a module (16K pages, Rust).
  • Warnings: both builds pass with no new warnings compared with aurora-wip (35c7d87921c0).
  • checkpatch --strict: clean, apart from the project's Assisted-by: LLM trailer-format warning.
  • Merge check: merges cleanly with aurora-wip and with the other follow-up branches.

Provenance

Written for this PR from the public driver source and the review finding.

🤖 Generated with Claude Code

…eded

The startup work applies the country package to cfg80211's channel list
before it checks whether the request it is serving is still current. If
the country changes again while the work is loading the first package,
cfg80211 has already recomputed the channel flags for the second
country, and the stale pass then disables the first country's forbidden
channels on top of them. The next pass adds the second country's own
disables, so the union of both stays in place until the following
regulatory change.

The result is only ever more restrictive than intended, and the boot
sequence cannot hit it because the world package forbids nothing, but a
user who changes country twice in quick succession loses channels that
the final country permits.

The regulatory notifier runs under RTNL and starts a new generation
there, after cfg80211 has recomputed the flags. Check the generation
under RTNL in mt_policy_disable() and leave the channel list alone when
it has moved on; the newer generation runs its own pass.

Fixes: 6e3838e ("wifi: mt7932: honour the channel permissions of the country package")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit ef4ae11 into aurora-wip Oct 8, 2026
@DjDeveloperr
DjDeveloperr deleted the fix/mt7932-stale-policy-pass branch October 12, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant