2022-09-13 09:32:12

by Shengjiu Wang

[permalink] [raw]
Subject: [PATCH] ASoC: imx-card: Fix refcount issue with of_node_put

imx_card_parse_of will search all the node with loop,
if there is defer probe happen in the middle of loop,
the previous released codec node will be released
twice, then cause refcount issue.

Here assign NULL to pointer of released nodes to fix
the issue.

Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver")
Signed-off-by: Shengjiu Wang <[email protected]>
---
sound/soc/fsl/imx-card.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c
index 14be29530fb5..3f128ced4180 100644
--- a/sound/soc/fsl/imx-card.c
+++ b/sound/soc/fsl/imx-card.c
@@ -698,6 +698,10 @@ static int imx_card_parse_of(struct imx_card_data *data)
of_node_put(cpu);
of_node_put(codec);
of_node_put(platform);
+
+ cpu = NULL;
+ codec = NULL;
+ platform = NULL;
}

return 0;
--
2.34.1


2022-09-13 15:37:15

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] ASoC: imx-card: Fix refcount issue with of_node_put

On Tue, 13 Sep 2022 17:00:01 +0800, Shengjiu Wang wrote:
> imx_card_parse_of will search all the node with loop,
> if there is defer probe happen in the middle of loop,
> the previous released codec node will be released
> twice, then cause refcount issue.
>
> Here assign NULL to pointer of released nodes to fix
> the issue.
>
> [...]

Applied to

broonie/sound.git for-linus

Thanks!

[1/1] ASoC: imx-card: Fix refcount issue with of_node_put
commit: d56ba9a04d7548d4149c46ec86a0e3cc41a70f4a

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark