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

Will Porter <[email protected]>
Newsgroups gmane.linux.sound,gmane.linux.kernel
Message-ID <[email protected]>
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/[email protected]

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.