Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andrei Aleksandrov" <aladex@gmail.com>
Cc: linux-input@vger.kernel.org, linux-sound@vger.kernel.org,
	dmitry.torokhov@gmail.com
Subject: Re: [PATCH RFC 1/2] ALSA: usb-audio: Add Windows volume scale quirk for EPOS GSX 1000 v2
Date: Fri, 27 Nov 2026 07:28:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-236803@kernel.org> (raw)
In-Reply-To: <20261127-gsx1000-v1-1-833554c37b82@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] ALSA: usb-audio: vol->lock deadlock on autoresume in
  snd_gsx1000_vol_write()
--

commit 2cdf48294d1e8337d55eb62590e00ec94a1f72ea
Author: Andrei Aleksandrov <aladex@gmail.com>

ALSA: usb-audio: Add Windows volume scale quirk for EPOS GSX 1000 v2

This commit replaces the standard Feature Unit 12 volume control on the
EPOS GSX 1000 v2 with a mixer quirk control that writes the Windows volume
table values to channels 1 and 2.

Link: https://github.com/Aladex/epos-gsx

> diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
> index 4c7d68311f204..6e96e80208558 100644
> --- a/sound/usb/mixer_quirks.c
> +++ b/sound/usb/mixer_quirks.c

[ ... ]

> +/* Caller holds vol->lock */
> +static int snd_gsx1000_vol_write(struct snd_gsx1000_vol *vol)
> +{
> +	struct snd_usb_audio *chip = vol->list.mixer->chip;
> +	__le16 buf;
> +	int ch, err;
> +
> +	CLASS(snd_usb_lock, pm)(chip);
> +	if (pm.err < 0)
> +		return pm.err;

[ ... ]

> +static int snd_gsx1000_vol_set(struct snd_gsx1000_vol *vol, unsigned int value)
> +{
> +	guard(mutex)(&vol->lock);
> +	return __snd_gsx1000_vol_set(vol, value);
> +}

[ ... ]

> +static int snd_gsx1000_vol_resume(struct usb_mixer_elem_list *list)
> +{
> +	struct snd_gsx1000_vol *vol = to_gsx1000_vol(list);
> +
> +	guard(mutex)(&vol->lock);
> +	return snd_gsx1000_vol_write(vol);
> +}

[Severity: High]
Can calling CLASS(snd_usb_lock, pm)(chip) under vol->lock deadlock when
the device is runtime-suspended?

snd_usb_lock_shutdown() calls snd_usb_autoresume(), which invokes
usb_autopm_get_interface() and runs the resume callback synchronously on
the calling thread:

snd_gsx1000_vol_put()
  snd_gsx1000_vol_set()
    mutex_lock(&vol->lock)
    __snd_gsx1000_vol_set()
      snd_gsx1000_vol_write()
        snd_usb_lock_shutdown()
          snd_usb_autoresume()
            usb_autopm_get_interface()
              ...
                usb_audio_resume()
                  snd_usb_mixer_resume()
                    snd_gsx1000_vol_resume()
                      mutex_lock(&vol->lock)  <-- self-deadlock

Taking CLASS(snd_usb_lock, pm)(chip) before acquiring vol->lock avoids
entering runtime resume with vol->lock held.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-gsx1000-v1-0-833554c37b82@gmail.com?part=1

  reply	other threads:[~2026-11-27  7:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  7:15 [PATCH RFC 0/2] ALSA: usb-audio: Make the EPOS GSX 1000 v2 volume ring work Andrei Aleksandrov via B4 Relay
2026-11-27  7:15 ` [PATCH RFC 1/2] ALSA: usb-audio: Add Windows volume scale quirk for EPOS GSX 1000 v2 Andrei Aleksandrov via B4 Relay
2026-11-27  7:28   ` sashiko-bot [this message]
2026-11-27  7:15 ` [PATCH RFC 2/2] ALSA: usb-audio: Handle the EPOS GSX 1000 v2 volume ring in the driver Andrei Aleksandrov via B4 Relay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-236803@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=aladex@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox