[PATCH 0/6] ALSA: usb-audio: guard device-specific control transfers

Will Porter posted 6 patches 1 month ago
sound/usb/fcp.c             |  8 ++++++++
sound/usb/mixer_quirks.c    |  8 ++++++++
sound/usb/mixer_s1810c.c    |  8 ++++++++
sound/usb/mixer_scarlett.c  |  4 ++++
sound/usb/mixer_scarlett2.c | 36 ++++++++++++++++++++++++++++++------
sound/usb/mixer_us16x08.c   |  7 +++++++
6 files changed, 65 insertions(+), 6 deletions(-)
[PATCH 0/6] ALSA: usb-audio: guard device-specific control transfers
Posted by Will Porter 1 month ago
Takashi confirmed that hardware access through usb_ctl_msg() should hold
snd_usb_lock, and suggested guarding scarlett2_usb() as the central point
for Scarlett2. This series adds that protection to the six device-specific
paths identified by the RFC audit.

Each guard covers a complete synchronous USB transaction. The guards are
outside private data and USB mutexes when a resume callback could affect
lock ordering.

FCP holds one reference across its complete initialization sequence so
runtime suspend cannot intervene between step zero, notification-URB setup,
and the two initialization commands.

Scarlett2 uses a dedicated unguarded helper only for the suspend-time config
save. That call already runs inside the USB suspend callback. The guarded
path covers normal controls and hwdep operations. The series does not claim
to hold a PM reference across Scarlett2's asynchronous flash-erase interval.

The affected devices were unavailable for runtime testing. I reproduced the
failure mechanism with an Audient iD14 MkI mixer path before the RFC. I then
built the complete sound/usb/ directory with the configuration from the
running x86-64 distribution kernel (7.2.0-ogc4.1.fc44.x86_64):

  make olddefconfig
  make -j4 W=1 sound/usb/

All six changed objects compiled without warnings, and the build linked
sound/usb/snd-usb-audio.o. The series also passes scripts/checkpatch.pl
--strict with no errors, warnings, or checks.

Link: https://lore.kernel.org/r/20260824230302.27965-1-mrwillporter@gmail.com

Will Porter (6):
  ALSA: usb-audio: Add PM guard to Studio 1810c controls
  ALSA: usb-audio: Add PM guards to US-16x08 transfers
  ALSA: usb-audio: Add PM guard to Scarlett meter reads
  ALSA: usb-audio: Guard Scarlett2 protocol transfers
  ALSA: usb-audio: Add PM guards to RME Digiface controls
  ALSA: usb-audio: Guard FCP protocol transfers

 sound/usb/fcp.c             |  8 ++++++++
 sound/usb/mixer_quirks.c    |  8 ++++++++
 sound/usb/mixer_s1810c.c    |  8 ++++++++
 sound/usb/mixer_scarlett.c  |  4 ++++
 sound/usb/mixer_scarlett2.c | 36 ++++++++++++++++++++++++++++++------
 sound/usb/mixer_us16x08.c   |  7 +++++++
 6 files changed, 65 insertions(+), 6 deletions(-)


base-commit: 58c1c30074a8d1179e17a0188cd695b2f416bf75
-- 
2.47.3
Re: [PATCH 0/6] ALSA: usb-audio: guard device-specific control transfers
Posted by Takashi Iwai 3 weeks, 5 days ago
On Fri, 28 Aug 2026 01:21:37 +0200,
Will Porter wrote:
> 
> Takashi confirmed that hardware access through usb_ctl_msg() should hold
> snd_usb_lock, and suggested guarding scarlett2_usb() as the central point
> for Scarlett2. This series adds that protection to the six device-specific
> paths identified by the RFC audit.
> 
> Each guard covers a complete synchronous USB transaction. The guards are
> outside private data and USB mutexes when a resume callback could affect
> lock ordering.
> 
> FCP holds one reference across its complete initialization sequence so
> runtime suspend cannot intervene between step zero, notification-URB setup,
> and the two initialization commands.
> 
> Scarlett2 uses a dedicated unguarded helper only for the suspend-time config
> save. That call already runs inside the USB suspend callback. The guarded
> path covers normal controls and hwdep operations. The series does not claim
> to hold a PM reference across Scarlett2's asynchronous flash-erase interval.
> 
> The affected devices were unavailable for runtime testing. I reproduced the
> failure mechanism with an Audient iD14 MkI mixer path before the RFC. I then
> built the complete sound/usb/ directory with the configuration from the
> running x86-64 distribution kernel (7.2.0-ogc4.1.fc44.x86_64):
> 
>   make olddefconfig
>   make -j4 W=1 sound/usb/
> 
> All six changed objects compiled without warnings, and the build linked
> sound/usb/snd-usb-audio.o. The series also passes scripts/checkpatch.pl
> --strict with no errors, warnings, or checks.
> 
> Link: https://lore.kernel.org/r/20260824230302.27965-1-mrwillporter@gmail.com
> 
> Will Porter (6):
>   ALSA: usb-audio: Add PM guard to Studio 1810c controls
>   ALSA: usb-audio: Add PM guards to US-16x08 transfers
>   ALSA: usb-audio: Add PM guard to Scarlett meter reads
>   ALSA: usb-audio: Guard Scarlett2 protocol transfers
>   ALSA: usb-audio: Add PM guards to RME Digiface controls
>   ALSA: usb-audio: Guard FCP protocol transfers

Applied all patches now.  Thanks.


Takashi