diff mbox series

ASoC: imx-card: Fix refcount issue with of_node_put

Message ID 1663059601-29259-1-git-send-email-shengjiu.wang@nxp.com (mailing list archive)
State Accepted
Commit d56ba9a04d7548d4149c46ec86a0e3cc41a70f4a
Headers show
Series ASoC: imx-card: Fix refcount issue with of_node_put | expand

Commit Message

Shengjiu Wang Sept. 13, 2022, 9 a.m. UTC
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 <shengjiu.wang@nxp.com>
---
 sound/soc/fsl/imx-card.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Mark Brown Sept. 13, 2022, 1:31 p.m. UTC | #1
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
diff mbox series

Patch

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;