FAILED: patch "[PATCH] ASoC: hdac_hda: Fix hlink refcount leak on component" failed to apply to 6.6-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 6ad4892c4f5cb437a928a02f5b7d37d496aa9268
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090903-snap-maker-9654@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 6ad4892c4f5cb437a928a02f5b7d37d496aa9268 Mon Sep 17 00:00:00 2001
From: Haoxiang Li <[email protected]>
Date: Mon, 22 Jun 2026 22:56:45 +0800
Subject: [PATCH] ASoC: hdac_hda: Fix hlink refcount leak on component
registration failure
hdac_hda_dev_probe() gets the HDA link with snd_hdac_ext_bus_link_get() before registering the ASoC component. If component registration fails, the function returns without dropping the link reference.
Always call snd_hdac_ext_bus_link_put() after the registration attempt so the reference taken during probe is balanced on both success and failure.
sound/soc/codecs/hdac_hda.c +1 -3
@@ -642,10 +642,8 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev) &hdac_hda_codec, hdac_hda_dais, ARRAY_SIZE(hdac_hda_dais)); -if (ret <0 ) { +if (ret <0 )dev_err (&hdev->dev,"%s: failed to register HDA codec %d\n" , __func__, ret); -return ret; - }snd_hdac_ext_bus_link_put (hdev->bus, hlink);
Sasha Levin
maintainerPATCH 1/2 ASoC: hdac_hda: improve error logs
From: Pierre-Louis Bossart <[email protected]>
[ Upstream commit ea5fee227ff3dae209062ac9544906debe1e9ac1 ]
We have a couple of duplicate logs and missing information, add __func__ consistently and make sure useful error codes are logged.
[Backport to 6.6: omit the firmware-patch-loader logging hunk, since this tree lacks the ASoC HDA patch loader introduced by 842a62a75e709. Keep the logging changes in existing functions, including the component registration error context required by 6ad4892c4f5cb437a928a02f5b7d37d496aa9268. Retain the stable stream-format API and do not add patch-loader support.]
Stable-dep-of: 6ad4892c4f5c ("ASoC: hdac_hda: Fix hlink refcount leak on component registration failure")
--- sound/soc/codecs/hdac_hda.c | 42 ++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 19 deletions(-)
sound/soc/codecs/hdac_hda.c +23 -19
@@ -224,7 +224,8 @@ static int hdac_hda_dai_hw_params(struct snd_pcm_substream *substream, 0);if (!format_val) {dev_err (dai->dev, -"invalid format_val, rate=%d, ch=%d, format=%d, maxbps=%d\n" , +"%s: invalid format_val, rate=%d, ch=%d, format=%d, maxbps=%d\n" , + __func__,params_rate (params),params_channels (params),params_format (params), maxbps);
@@ -260,14 +261,12 @@ static int hdac_hda_dai_prepare(struct snd_pcm_substream *substream,struct snd_soc_component *component = dai->component;struct hda_pcm_stream *hda_stream;struct hdac_hda_priv *hda_pvt; -struct hdac_device *hdev;unsigned int format_val;struct hda_pcm *pcm;unsigned int stream;int ret =0 ; hda_pvt =snd_soc_component_get_drvdata (component); - hdev = &hda_pvt->codec->core; pcm =snd_soc_find_pcm_from_dai (hda_pvt, dai);if (!pcm)return -EINVAL ;
@@ -280,7 +279,7 @@ static int hdac_hda_dai_prepare(struct snd_pcm_substream *substream, ret =snd_hda_codec_prepare (hda_pvt->codec, hda_stream, stream, format_val, substream);if (ret <0 ) -dev_err (&hdev->dev,"codec prepare failed %d\n" , ret); +dev_err (dai->dev,"%s: failed %d\n" , __func__, ret);return ret; }
@@ -292,6 +291,7 @@ static int hdac_hda_dai_open(struct snd_pcm_substream *substream,struct hdac_hda_priv *hda_pvt;struct hda_pcm_stream *hda_stream;struct hda_pcm *pcm; +int ret; hda_pvt =snd_soc_component_get_drvdata (component); pcm =snd_soc_find_pcm_from_dai (hda_pvt, dai);
@@ -302,7 +302,11 @@ static int hdac_hda_dai_open(struct snd_pcm_substream *substream, hda_stream = &pcm->stream[substream->stream]; -return hda_stream->ops.open (hda_stream, hda_pvt->codec, substream); + ret = hda_stream->ops.open (hda_stream, hda_pvt->codec, substream); +if (ret <0 ) +dev_err (dai->dev,"%s: failed %d\n" , __func__, ret); + +return ret; } static void hdac_hda_dai_close(struct snd_pcm_substream *substream,
@@ -361,7 +365,7 @@ static struct hda_pcm *snd_soc_find_pcm_from_dai(struct hdac_hda_priv *hda_pvt, pcm_name ="HDMI 3" ;break ;default : -dev_err (&hcodec->core.dev,"invalid dai id %d\n" , dai->id); +dev_err (dai->dev,"%s: invalid dai id %d\n" , __func__, dai->id);return NULL ; }
@@ -375,7 +379,7 @@ static struct hda_pcm *snd_soc_find_pcm_from_dai(struct hdac_hda_priv *hda_pvt, } } -dev_err (&hcodec->core.dev,"didn't find PCM for DAI %s\n" , dai->name); +dev_err (dai->dev,"%s: didn't find PCM for DAI %s\n" , __func__, dai->name);return NULL ; }
@@ -405,7 +409,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) hlink =snd_hdac_ext_bus_get_hlink_by_name (hdev->bus,dev_name (&hdev->dev));if (!hlink) { -dev_err (&hdev->dev,"hdac link not found\n" ); +dev_err (&hdev->dev,"%s: hdac link not found\n" , __func__);return -EIO ; }
@@ -423,7 +427,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) ret =snd_hda_codec_device_new (hcodec->bus, component->card->snd_card, hdev->addr, hcodec, true);if (ret <0 ) { -dev_err (&hdev->dev,"failed to create hda codec %d\n" , ret); +dev_err (&hdev->dev,"%s: failed to create hda codec %d\n" , __func__, ret); goto error_no_pm; }/*
@@ -443,13 +447,13 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) ret =snd_hda_codec_set_name (hcodec, hcodec->preset->name);if (ret <0 ) { -dev_err (&hdev->dev,"name failed %s\n" , hcodec->preset->name); +dev_err (&hdev->dev,"%s: name failed %s\n" , __func__, hcodec->preset->name); goto error_pm; } ret =snd_hdac_regmap_init (&hcodec->core);if (ret <0 ) { -dev_err (&hdev->dev,"regmap init failed\n" ); +dev_err (&hdev->dev,"%s: regmap init failed\n" , __func__); goto error_pm; }
@@ -457,16 +461,16 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)if (patch) { ret =patch (hcodec);if (ret <0 ) { -dev_err (&hdev->dev,"patch failed %d\n" , ret); +dev_err (&hdev->dev,"%s: patch failed %d\n" , __func__, ret); goto error_regmap; } }else { -dev_dbg (&hdev->dev,"no patch file found\n" ); +dev_dbg (&hdev->dev,"%s: no patch file found\n" , __func__); } ret =snd_hda_codec_parse_pcms (hcodec);if (ret <0 ) { -dev_err (&hdev->dev,"unable to map pcms to dai %d\n" , ret); +dev_err (&hdev->dev,"%s: unable to map pcms to dai %d\n" , __func__, ret); goto error_patch; }
@@ -474,8 +478,8 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)if (!is_hdmi_codec (hcodec)) { ret =snd_hda_codec_build_controls (hcodec);if (ret <0 ) { -dev_err (&hdev->dev,"unable to create controls %d\n" , - ret); +dev_err (&hdev->dev,"%s: unable to create controls %d\n" , + __func__, ret); goto error_patch; } }
@@ -521,7 +525,7 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component) hlink =snd_hdac_ext_bus_get_hlink_by_name (hdev->bus,dev_name (&hdev->dev));if (!hlink) { -dev_err (&hdev->dev,"hdac link not found\n" ); +dev_err (&hdev->dev,"%s: hdac link not found\n" , __func__);return ; }
@@ -597,7 +601,7 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev)/* hold the ref while we probe */ hlink =snd_hdac_ext_bus_get_hlink_by_name (hdev->bus,dev_name (&hdev->dev));if (!hlink) { -dev_err (&hdev->dev,"hdac link not found\n" ); +dev_err (&hdev->dev,"%s: hdac link not found\n" , __func__);return -EIO ; }snd_hdac_ext_bus_link_get (hdev->bus, hlink);
@@ -613,7 +617,7 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev) ARRAY_SIZE(hdac_hda_dais));if (ret <0 ) { -dev_err (&hdev->dev,"failed to register HDA codec %d\n" , ret); +dev_err (&hdev->dev,"%s: failed to register HDA codec %d\n" , __func__, ret);return ret; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 ASoC: hdac_hda: Fix hlink refcount leak on component registration failure
From: Haoxiang Li <[email protected]>
[ Upstream commit 6ad4892c4f5cb437a928a02f5b7d37d496aa9268 ]
hdac_hda_dev_probe() gets the HDA link with snd_hdac_ext_bus_link_get() before registering the ASoC component. If component registration fails, the function returns without dropping the link reference.
Always call snd_hdac_ext_bus_link_put() after the registration attempt so the reference taken during probe is balanced on both success and failure.
--- sound/soc/codecs/hdac_hda.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/soc/codecs/hdac_hda.c +1 -3
@@ -616,10 +616,8 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev) &hdac_hda_codec, hdac_hda_dais, ARRAY_SIZE(hdac_hda_dais)); -if (ret <0 ) { +if (ret <0 )dev_err (&hdev->dev,"%s: failed to register HDA codec %d\n" , __func__, ret); -return ret; - }snd_hdac_ext_bus_link_put (hdev->bus, hlink);
Signature · 1 line
2.53.0