All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chen Yuxi" <chenyuxi19@huawei.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH] ASoC: wm8962: Fix broken headset button caused by wrong guard constant
Date: Tue, 17 Nov 2026 07:30:49 +0000	[thread overview]
Message-ID: <sashiko-outbox-218352@kernel.org> (raw)
In-Reply-To: <20261117070516.3861828-1-chenyuxi19@huawei.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] ASoC: wm8962: use-after-free in wm8962_mic_work() [1]
--

commit 8a0c59cf23261f48f72e00d3d31993d38fafcde5
Author: Chen Yuxi <chenyuxi19@huawei.com>

ASoC: wm8962: Fix broken headset button caused by wrong guard constant

This commit updates wm8962_mic_work() to test wm8962->mic_status against
SND_JACK_MICROPHONE instead of WM8962_MICDET_STS so that headset button
presses are reported when a microphone is already present.

> diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
> index 148480e4124fc..a4868685218b4 100644
> --- a/sound/soc/codecs/wm8962.c
> +++ b/sound/soc/codecs/wm8962.c
> @@ -3127,7 +3127,7 @@ static void wm8962_mic_work(struct work_struct *work)
>  		/* Don't report a microphone if it's shorted right after
>  		 * plugging in, as this may be a TRS plug in a TRRS socket.
>  		 */
> -		if (!(wm8962->mic_status & WM8962_MICDET_STS))
> +		if (!(wm8962->mic_status & SND_JACK_MICROPHONE))
>  			status = 0;
>  	}
>  

[Severity: Critical]
This problem wasn't introduced by this patch, but can wm8962_irq()
re-queue wm8962->mic_work [1] after wm8962_remove() cancels it?

The interrupt is requested during I2C probe and remains active across
ASoC component unbind, while wm8962_remove() cancels wm8962->mic_work
without masking the mic detection interrupts first:

CPU0                                  CPU1
wm8962_remove()
  cancel_delayed_work_sync(&wm8962->mic_work)
                                      wm8962_irq()
                                        queue_delayed_work(...,
                                          &wm8962->mic_work, ...)
  ... component freed ...
                                      wm8962_mic_work()
                                        snd_soc_component_read(component, ...)
                                          <-- use-after-free

[1] https://sashiko.dev/#/bug/linux-315f7aab-37ed-4fee-a0af-5ebeb7b5ed74

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117070516.3861828-1-chenyuxi19@huawei.com?part=1

  reply	other threads:[~2026-11-17  7:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  7:05 [PATCH] ASoC: wm8962: Fix broken headset button caused by wrong guard constant Chen Yuxi
2026-11-17  7:30 ` sashiko-bot [this message]
2026-11-17 10:07 ` Charles Keepax
2026-11-17 13:57 ` Sebastian Krzyszkowiak

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-218352@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=chenyuxi19@huawei.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.