From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382981; b=w4f+9C+uhJDSWtEMHRmUJg5j6DSQi0oPMPGKfAnVoeM7k7nJKmG6GEMA/bVclTfph1UF GYNCdmaHSccdbsCQpD5UpDpL6c+vXsnDjP8mZb/IOoqO5NXzPKvncoZdwy5Ez+brnJIWL Ue5SsiOm7OM3eKaOe9k+mcMKktGIJ3nuRZRPZ/cwjRgR5ro3nafaotA9vAuEY5PCXOuse T9eLpoPe0+QXQjrmOZ/326v1xK64wFOluskachiYswz6u/SuFGVcrjnH+1YqLS8VPFbo8 U597Qcaneq0YcYz0oMFNDVhkma6mT/EKpDTNdidQ9lUvIdPRZqoPor8sdwT/aDMSWEA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382981; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=0gaM4g4YVfHds7wsENJeuiFG9AraXDWSKlIDXEpR0Lg=; b=tmry8fB1DcPuxgIzjzl/8z+67rH6+PFhjiBsXz2MNYI9wNdt4boDlAgMJVOYLOWReQKu a85EJXmvGujpv6Zmk8UZQkfU36Nf0/N7+R+vGPvUtIo6pLKB385ieWfHUv0R606GpjA1g QpJD5ZxcGp8SaUEXwsm041QDCTh7U3V260HLXVaKsOLYEl00D7P3adheloAtJUhzpAk46 mMJFCmHnuRAsHJ2KSFz+vD6GS/iC9QlzTJXWTUkXZAe4FnoghsG9xNvSAsq0FDf+I2Jhy ChkgUO2vhY9A/bsyceDUYHkAHM+qZ7x8cryoYoahGHqA5WhoqnUvQzKc47BnsfApieA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="iR/eoWy3"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54F8A606A322; Fri, 4 Dec 2026 11:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=iR/eoWy3 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2AB81F000CE; Fri, 4 Dec 2026 11:16:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382981; bh=0gaM4g4YVfHds7wsENJeuiFG9AraXDWSKlIDXEpR0Lg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=iR/eoWy3d7Cki6qtDIWwBFJN7C2SnGBCB1jZOcjMfjAmRBTRHLNrZanlbsY7owZ79 1DU1T1wRYhXuAxjYZ2LhahBFVmk5jI66dIEpDPAyHkjV4PSQ/k4twEas9M7LToNOpD v2muYvkwUXDHSILdrlL2Mbz1h+TFjRu8NYSwNnTw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Carmel Okun , Akhil Arul , Takashi Iwai Subject: [PATCH 6.18 625/703] ALSA: hda/tas2781-spi: Set tas_hda->dev in probe Date: Fri, 4 Dec 2026 19:08:44 +0900 Message-ID: <20261204100644.413117179@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Akhil Arul commit d1458f8c2282975f2bd7467cd3c3cf4c0c58c1ca upstream. 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 Closes: https://lore.kernel.org/linux-sound/AS2PR02MB10038DB2CE8CAE659D35B9F1AC8792@AS2PR02MB10038.eurprd02.prod.outlook.com/ Cc: stable@vger.kernel.org Signed-off-by: Akhil Arul Link: https://patch.msgid.link/20261120125729.135171-1-akhilarul324@gmail.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/hda/codecs/side-codecs/tas2781_hda_spi.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/hda/codecs/side-codecs/tas2781_hda_spi.c +++ b/sound/hda/codecs/side-codecs/tas2781_hda_spi.c @@ -786,6 +786,7 @@ static int tas2781_hda_spi_probe(struct if (!hda_priv) return -ENOMEM; + tas_hda->dev = &spi->dev; tas_hda->hda_priv = hda_priv; spi->max_speed_hz = TAS2781_SPI_MAX_FREQ;