mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Akhil Arul <akhilarul324@gmail.com>
Cc: perex@perex.cz, tiwai@suse.com, shenghao-ding@ti.com,
	baojun.xu@ti.com, Carmel@aperio.ai, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] ALSA: hda/tas2781-spi: Set tas_hda->dev in probe
Date: Fri, 20 Nov 2026 18:11:54 +0100	[thread overview]
Message-ID: <8733svwhph.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261120125729.135171-1-akhilarul324@gmail.com>

On Fri, 20 Nov 2026 13:57:29 +0100,
Akhil Arul wrote:
> 
> tas2781_hda_remove() is shared by the I2C and SPI drivers and uses
> tas_hda->dev for component_del() and for the runtime PM calls.  The I2C
> probe sets that field, the SPI probe does not, so for SPI it stays NULL
> from the devm_kzalloc().  Unbinding the device through sysfs then warns
> in component_del() and crashes on the NULL device in pm_runtime_get_sync():
> 
>   WARNING: drivers/base/component.c:839 at component_del+0x149/0x170
>   Call Trace:
>    tas2781_hda_remove+0x16/0x60 [snd_hda_scodec_tas2781]
>    device_release_driver_internal+0x19e/0x200
>    unbind_store+0xa4/0xb0
>   Oops: general protection fault, kernel NULL pointer dereference 0x1d1
>   RIP: 0010:__pm_runtime_resume+0x1a/0x90
>    tas2781_hda_remove+0x23/0x60 [snd_hda_scodec_tas2781]
> 
> The same path runs from the driver remove callback and from the
> component_add() failure path in tas2781_hda_spi_probe().
> 
> Before the common library was introduced, the SPI driver had its own
> remove function that used tas_priv->dev.  Set tas_hda->dev in
> tas2781_hda_spi_probe(), as the I2C driver does.
> 
> Tested the probe/unbind path with KASAN and lockdep enabled: without this
> change, unbinding the device gives the warning and oops above; with it,
> unbind, bind and unbind again complete without any splat.
> 
> Fixes: 28a09d9e42c5 ("ALSA: hda/tas2781: Create an independent lib to save the shared parts for both SPI and I2C driver")
> Reported-by: Carmel Okun <Carmel@aperio.ai>
> Closes: https://lore.kernel.org/linux-sound/AS2PR02MB10038DB2CE8CAE659D35B9F1AC8792@AS2PR02MB10038.eurprd02.prod.outlook.com/
> Cc: stable@vger.kernel.org
> Signed-off-by: Akhil Arul <akhilarul324@gmail.com>

Applied now.  Thanks.


Takashi

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 12:57 Akhil Arul
2026-11-20 17:11 ` 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=8733svwhph.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=Carmel@aperio.ai \
    --cc=akhilarul324@gmail.com \
    --cc=baojun.xu@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=shenghao-ding@ti.com \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.com \
    /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

all inboxes | Powered by JetHome®