]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: qcom: common: Fix refcounting in qcom_snd_parse_of()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 5 Nov 2020 12:51:54 +0000 (15:51 +0300)
committerMark Brown <broonie@kernel.org>
Tue, 10 Nov 2020 17:28:25 +0000 (17:28 +0000)
commitd528b3bd85f5c4f2c16e28de2b7b017a4eca2a19
treedb796adcaf177bf737bdae5182ab3e45c62b33c0
parent211d73eee07e80018ad0cd7b0a3c3745a5ba29ab
ASoC: qcom: common: Fix refcounting in qcom_snd_parse_of()

There are two issues in this function.

1) We can't drop the refrences on "cpu", "codec" and "platform" before
   we take the reference.  This doesn't cause a problem on the first
   iteration because those pointers start as NULL so the of_node_put()
   is a no-op.  But on the subsequent iterations, it will lead to a use
   after free.

2) If the devm_kzalloc() allocation failed then the code returned
   directly instead of cleaning up.

Fixes: 3df5c019ca4d ("ASoC: qcom: common: Fix refcount imbalance on error")
Fixes: cb6567e9eb48 ("ASoC: qcom: common: use modern dai_link style")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20201105125154.GA176426@mwanda
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/qcom/common.c