* FAILED: patch "[PATCH] ASoC: topology: Fix memleak in soc_tplg_manifest_load()" failed to apply to 4.14-stable tree
@ 2020-03-09 20:35 gregkh
2020-03-10 14:02 ` [PATCH v4.14] ASoC: topology: Fix memleak in soc_tplg_manifest_load() Dragos Tarcatu
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2020-03-09 20:35 UTC (permalink / raw)
To: dragos_tarcatu, broonie; +Cc: stable
The patch below does not apply to the 4.14-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 <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 242c46c023610dbc0213fc8fb6b71eb836bc5d95 Mon Sep 17 00:00:00 2001
From: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Date: Fri, 7 Feb 2020 20:53:25 +0200
Subject: [PATCH] ASoC: topology: Fix memleak in soc_tplg_manifest_load()
In case of ABI version mismatch, _manifest needs to be freed as
it is just a copy of the original topology manifest. However, if
a driver manifest handler is defined, that would get executed and
the cleanup is never reached. Fix that by getting the return status
of manifest() instead of returning directly.
Fixes: 583958fa2e52 ("ASoC: topology: Make manifest backward compatible from ABI v4")
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Link: https://lore.kernel.org/r/20200207185325.22320-3-dragos_tarcatu@mentor.com
Signed-off-by: Mark Brown <broonie@kernel.org>
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 953517a73298..22c38df40d5a 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -2544,7 +2544,7 @@ static int soc_tplg_manifest_load(struct soc_tplg *tplg,
{
struct snd_soc_tplg_manifest *manifest, *_manifest;
bool abi_match;
- int err;
+ int ret = 0;
if (tplg->pass != SOC_TPLG_PASS_MANIFEST)
return 0;
@@ -2557,19 +2557,19 @@ static int soc_tplg_manifest_load(struct soc_tplg *tplg,
_manifest = manifest;
} else {
abi_match = false;
- err = manifest_new_ver(tplg, manifest, &_manifest);
- if (err < 0)
- return err;
+ ret = manifest_new_ver(tplg, manifest, &_manifest);
+ if (ret < 0)
+ return ret;
}
/* pass control to component driver for optional further init */
if (tplg->comp && tplg->ops && tplg->ops->manifest)
- return tplg->ops->manifest(tplg->comp, tplg->index, _manifest);
+ ret = tplg->ops->manifest(tplg->comp, tplg->index, _manifest);
if (!abi_match) /* free the duplicated one */
kfree(_manifest);
- return 0;
+ return ret;
}
/* validate header magic, size and type */
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v4.14] ASoC: topology: Fix memleak in soc_tplg_manifest_load()
2020-03-09 20:35 FAILED: patch "[PATCH] ASoC: topology: Fix memleak in soc_tplg_manifest_load()" failed to apply to 4.14-stable tree gregkh
@ 2020-03-10 14:02 ` Dragos Tarcatu
2020-03-10 14:44 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Dragos Tarcatu @ 2020-03-10 14:02 UTC (permalink / raw)
To: gregkh; +Cc: broonie, dragos_tarcatu, stable
commit 242c46c023610dbc0213fc8fb6b71eb836bc5d95 upstream.
In case of ABI version mismatch, _manifest needs to be freed as
it is just a copy of the original topology manifest. However, if
a driver manifest handler is defined, that would get executed and
the cleanup is never reached. Fix that by getting the return status
of manifest() instead of returning directly.
Fixes: 583958fa2e52 ("ASoC: topology: Make manifest backward compatible from ABI v4")
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Link: https://lore.kernel.org/r/20200207185325.22320-3-dragos_tarcatu@mentor.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/soc-topology.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 72301bcad3bd..cf04739aed48 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -2330,7 +2330,7 @@ static int soc_tplg_manifest_load(struct soc_tplg *tplg,
{
struct snd_soc_tplg_manifest *manifest, *_manifest;
bool abi_match;
- int err;
+ int ret = 0;
if (tplg->pass != SOC_TPLG_PASS_MANIFEST)
return 0;
@@ -2343,19 +2343,19 @@ static int soc_tplg_manifest_load(struct soc_tplg *tplg,
_manifest = manifest;
} else {
abi_match = false;
- err = manifest_new_ver(tplg, manifest, &_manifest);
- if (err < 0)
- return err;
+ ret = manifest_new_ver(tplg, manifest, &_manifest);
+ if (ret < 0)
+ return ret;
}
/* pass control to component driver for optional further init */
if (tplg->comp && tplg->ops && tplg->ops->manifest)
- return tplg->ops->manifest(tplg->comp, _manifest);
+ ret = tplg->ops->manifest(tplg->comp, _manifest);
if (!abi_match) /* free the duplicated one */
kfree(_manifest);
- return 0;
+ return ret;
}
/* validate header magic, size and type */
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v4.14] ASoC: topology: Fix memleak in soc_tplg_manifest_load()
2020-03-10 14:02 ` [PATCH v4.14] ASoC: topology: Fix memleak in soc_tplg_manifest_load() Dragos Tarcatu
@ 2020-03-10 14:44 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2020-03-10 14:44 UTC (permalink / raw)
To: Dragos Tarcatu; +Cc: broonie, stable
On Tue, Mar 10, 2020 at 04:02:11PM +0200, Dragos Tarcatu wrote:
> commit 242c46c023610dbc0213fc8fb6b71eb836bc5d95 upstream.
>
> In case of ABI version mismatch, _manifest needs to be freed as
> it is just a copy of the original topology manifest. However, if
> a driver manifest handler is defined, that would get executed and
> the cleanup is never reached. Fix that by getting the return status
> of manifest() instead of returning directly.
>
> Fixes: 583958fa2e52 ("ASoC: topology: Make manifest backward compatible from ABI v4")
> Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
> Link: https://lore.kernel.org/r/20200207185325.22320-3-dragos_tarcatu@mentor.com
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
> sound/soc/soc-topology.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
Thanks for the backport, now queued up.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-10 14:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-09 20:35 FAILED: patch "[PATCH] ASoC: topology: Fix memleak in soc_tplg_manifest_load()" failed to apply to 4.14-stable tree gregkh
2020-03-10 14:02 ` [PATCH v4.14] ASoC: topology: Fix memleak in soc_tplg_manifest_load() Dragos Tarcatu
2020-03-10 14:44 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).