ALSA: usb-audio: Add PM guards to RME Digiface controls

The RME Digiface status and register helpers issue vendor requests
without preventing runtime suspend or disconnect. The volatile status
controls can repeatedly reach these unguarded paths while userspace
polls them.

Protect both helpers with snd_usb_lock. All Digiface get and put
callbacks then resume the device and hold the disconnect reference
across their transfer.

Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Will Porter <mrwillporter@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260827232143.149197-6-mrwillporter@gmail.com
This commit is contained in:
Will Porter 2026-08-27 18:21:42 -05:00 committed by Takashi Iwai
parent de01880473
commit 9d4ae593fc

View File

@ -3480,6 +3480,10 @@ static int snd_rme_digiface_write_reg(struct snd_kcontrol *kcontrol, int item, u
struct usb_device *dev = chip->dev;
int err;
CLASS(snd_usb_lock, pm)(chip);
if (pm.err < 0)
return -EIO;
err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0),
item,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
@ -3499,6 +3503,10 @@ static int snd_rme_digiface_read_status(struct snd_kcontrol *kcontrol, u32 statu
__le32 buf[4] = {};
int err;
CLASS(snd_usb_lock, pm)(chip);
if (pm.err < 0)
return -EIO;
err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0),
RME_DIGIFACE_READ_STATUS,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,