Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: WenTao Liang <vulab@iscas.ac.cn>
Cc: perex@perex.cz, tiwai@suse.com, chenziqing@xiaomi.com,
	broonie@kernel.org, cezary.rojewski@intel.com, kees@kernel.org,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] ALSA: control: Fix power refcount leak in snd_ctl_elem_read_user
Date: Fri, 12 Jun 2026 09:55:21 +0200	[thread overview]
Message-ID: <87wlw4i45y.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260612022702.15371-1-vulab@iscas.ac.cn>

On Fri, 12 Jun 2026 04:27:02 +0200,
WenTao Liang wrote:
> 
> snd_power_ref_and_wait() increments the power refcount before waiting.
> When it returns an error (e.g., -ENODEV due to card shutdown), the
> refcount is still held, as documented in its comment:
> 
>   "The caller needs to pull down the refcount via snd_power_unref()
>    later no matter whether the error is returned from this function
>    or not."
> 
> snd_ctl_elem_read_user() fails to release this refcount on the error
> path, leaking a reference. This can impede proper card resource
> cleanup during shutdown sequences.
> 
> Fix by calling snd_power_unref() before returning the error.
> 
> Cc: stable@vger.kernel.org
> Fixes: fcc62b19104a ("ALSA: control: Take power_ref lock primarily")
> Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>

Your all other patches for sound/core/* look like similar fixes, and
should be better put in a single fix patch.  If need to split to
multiple patches, though, please send a series of patches in a thread,
instead, at the next time.


thanks,

Takashi

      reply	other threads:[~2026-06-12  7:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12  2:27 [PATCH] ALSA: control: Fix power refcount leak in snd_ctl_elem_read_user WenTao Liang
2026-06-12  7:55 ` Takashi Iwai [this message]

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=87wlw4i45y.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=chenziqing@xiaomi.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.com \
    --cc=vulab@iscas.ac.cn \
    /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