Skip to content

ALSA: usb-audio: guard device-specific control transfers

Will Porter linux-sound lkml 1 version Applied

Status from this message: Applied all patches now. Thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/6ALSA: usb-audio: Add PM guard to Studio 1810c controlssound/usb/mixer_s1810c.c+8 -00 replies
2/6ALSA: usb-audio: Add PM guards to US-16x08 transferssound/usb/mixer_us16x08.c+7 -00 replies
3/6ALSA: usb-audio: Add PM guard to Scarlett meter readssound/usb/mixer_scarlett.c+4 -00 replies
4/6ALSA: usb-audio: Guard Scarlett2 protocol transferssound/usb/mixer_scarlett2.c+30 -60 replies
5/6ALSA: usb-audio: Add PM guards to RME Digiface controlssound/usb/mixer_quirks.c+8 -00 replies
6/6ALSA: usb-audio: Guard FCP protocol transferssound/usb/fcp.c+8 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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.

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

Signature · 1 line
2.47.3