Skip to content

ASoC: macaudio: keep the speaker route while protection is granted - #1017

Merged
RyanTheTide merged 1 commit into
sgv2-kernel-interfacefrom
aud/speaker-mux-fixed
Nov 6, 2026
Merged

RyanTheTide merged 1 commit into
sgv2-kernel-interfacefrom
aud/speaker-mux-fixed

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

"Speaker Playback Mux" picks the front-end that drives the speakers. Any user of the card can still write it while speakerguardd v2 holds a protection grant. On the MCA machines (J316, J413 and the M1 boards) both front-ends are real PCMs, so the write routes the other front-end, which has no protection in its path, to the amps at the granted operating point.

The supervisor already catches this on its next tick (it checks the route every 10 ms and withdraws on a mismatch), so the exposure is at most one tick, or one lease if the supervisor is dead. This closes it in the kernel: the mux refuses writes with -EBUSY while protection is granted. Before a grant the route can still change as before, because the owner checks the route before it grants. The self-check's route change happens before its grant, and the J616s/J713 front-end layout is unaffected.

Found by the speakerguardd v2 safety audit.

Tests (buildbox, kunit.py run --arch=arm64 LLVM=1, macaudio suites): 45/45 passed, including two new cases:

  • macaudio_route_is_protected: only the speaker mux gets the check, the headphone mux doesn't.
  • macaudio_route_fixed_while_granted: writable unowned and owned, -EBUSY while granted, writable again after release and after the owner closes.

checkpatch: 0 errors, 0 warnings.

🤖 Generated with Claude Code

"Speaker Playback Mux" picks the front-end that drives the speakers.
The owner of "Speaker Protection" grants playback for the front-end its
protection engine runs on, but the mux stays writable by any user of
the card. On the MCA machines (J316, J413, J274, J293, J313 and their
siblings) both front-ends are real PCMs, so a write under a running
grant routes the other one, which carries no protection, to the amps.
The owner notices on its next check of the route and withdraws, but
until then that stream plays at the granted operating point.

Refuse writes to the speaker mux with -EBUSY while protection is
granted. Before a grant the route may change as before: the owner
checks it before it grants.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
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