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=1795036988; b=amLVKA/CamRkz0eCaco6+5OAwE4NM5vV1ClZcIbOap804c2Sw0mgMRK7TWaT/ihZgYQb LHeHJ0Bq27wUaoyVlWa7xRrCE9oo1oJg2gegIg/4KsYsZjx5igF9uC8d7bD20ynKkZe0N GFZm7eDg4hFJ/kfHgD7rIZQnhBncdy1UhlBLAMlJU50ceGazE6wlmuHi3+pGJ2D2R6afw BWT+NFFD/rULZMKbaU/yYAR6Th4k2Tpc8ZiUlQdVExRz7Ooj8okFs2aHqxZZODnhr7pkq n+D+Djh96+4P/tOojxOLI1GgehiRYHiVhE/SubFFKYbKnaB9cMms0GVryTzkTD11UuQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795036988; 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=3AdsAa6w69/HCiqDoKyITBQ6019ddGs1JDeQ6wKLHrI=; b=YI1wLcidJPHB623Wf9Cn1un31cLwayrsyWGOGrA8IL8Ux0Bkcav5BC6e56ZZj2ITF5IZ gNfv3w5sdWzPSsJ8AqhDOAwEoyDKwnrpuA1RIGyY17lFo2YNmjJFcC9UhdXVXdqSp9o6T FjIROzFwDGKHyxsAruj8T3h/Df/yGcs0e+KwKJvbzaJbbzlbmR0tQewHRNCYkySrmVnia itFslQG4vSISQ/IzHkNjszre1LTPzmYeaSiRROczwON0jUoxipjeByk7oGK6U7BWlBQq3 ui6muih2JbwWWdkrfCaw8jGOXg1a8MiDRkNLkDNNeTaxsKmowW0RCqd2AKO9CWMksDw== 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=Wnx4qK7k; 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 84A9F60A2600; Wed, 18 Nov 2026 21:23:08 +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=Wnx4qK7k Received: by smtp.kernel.org (Postfix) with ESMTPSA id D06C61F000C4; Wed, 18 Nov 2026 21:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795036988; bh=3AdsAa6w69/HCiqDoKyITBQ6019ddGs1JDeQ6wKLHrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Wnx4qK7kv9KLjLBt2NRVqrp6siHKcyXwwH9JDNTlsa9iciBdhyx52b9UBOB0PVawB KITl1yzYx9m3zlCNRUkvcX5JZDE8M2wIh+hD4FIyP5SCDcEgA9IV1YGieVoD2bw5Gb /EYqkICcYryRV7UZOeR1Nc4/le7s0qwAXp7AZRqQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Peter Ujfalusi , Mark Brown , Sasha Levin Subject: [PATCH 6.6 1255/3318] ASoC: hdac_hda: Balance the runtime PM disable in codec remove Date: Wed, 18 Nov 2026 15:31:17 +0100 Message-ID: <20261118150357.849193805@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150313.527275416@linuxfoundation.org> References: <20261118150313.527275416@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Ujfalusi [ Upstream commit f26c0d5f91d918bb66cbbc8916f41836adb38346 ] hdac_hda_codec_remove() disables runtime PM of the codec device before releasing the HDA link and calling the codec driver's remove callback, so that no runtime resume can race with the teardown and access the link or the already freed codec driver data. snd_hda_codec_cleanup_for_unbind() then disables runtime PM again. On the next probe snd_hda_codec_register() enables runtime PM only once, leaving it disabled after the ASoC card or the codec driver has been unbound and bound again: the codec stays powered and runtime_status reads 'unsupported'. Re-enable runtime PM at the end of hdac_hda_codec_remove() to balance its own disable. The codec remains disabled until it is registered again. Fixes: c3ec8ac82105 ("ASoC: hdac_hda: fix memleak on module unload") Cc: stable@vger.kernel.org Signed-off-by: Peter Ujfalusi Link: https://patch.msgid.link/20261027083840.28813-4-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/hdac_hda.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c index c497354251cb2..dfa47be25ebc4 100644 --- a/sound/soc/codecs/hdac_hda.c +++ b/sound/soc/codecs/hdac_hda.c @@ -525,6 +525,7 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component) return; } + /* prevent runtime PM callbacks while the link and the codec are torn down */ pm_runtime_disable(&hdev->dev); snd_hdac_ext_bus_link_put(hdev->bus, hlink); @@ -532,6 +533,9 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component) codec->patch_ops.free(codec); snd_hda_codec_cleanup_for_unbind(codec); + + /* Balances the disable above, cleanup_for_unbind keeps runtime PM disabled */ + pm_runtime_enable(&hdev->dev); } static const struct snd_soc_dapm_route hdac_hda_dapm_routes[] = { -- 2.53.0