ASoC: codecs: wcd93xx: fix OF node leaks on probe failure
Subsystems (4)
cover ASoC: codecs: wcd93xx: fix OF node leaks on probe failure
The original wcd938x driver has a couple of OF node reference leaks which have been reproduced in the two later added drivers.
Johan
Johan Hovold (3):
ASoC: codecs: wcd937x: fix OF node leaks on probe failure
ASoC: codecs: wcd938x: fix OF node leaks on probe failure
ASoC: codecs: wcd939x: fix OF node leaks on probe failure
sound/soc/codecs/wcd937x.c | 4 ++-- sound/soc/codecs/wcd938x.c | 3 +-- sound/soc/codecs/wcd939x.c | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-)
Signature · 1 line
2.51.2
PATCH 1/3 ASoC: codecs: wcd937x: fix OF node leaks on probe failure
The component match entry release function will drop the references taken while looking up the soundwire OF nodes when the platform device is unbound.
Drop the additional references taken to avoid leaking them on probe failure (e.g. probe deferral) and on driver unbind.
--- sound/soc/codecs/wcd937x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/wcd937x.c +2 -2
@@ -2843,7 +2843,7 @@ static int wcd937x_add_slave_components(struct wcd937x_priv *wcd937x,dev_err (dev,"Couldn't parse phandle to qcom,rx-device!\n" );return -ENODEV ; } -of_node_get (wcd937x->rxnode); +component_match_add_release (dev, matchptr, component_release_of, component_compare_of, wcd937x->rxnode);
@@ -2852,7 +2852,7 @@ static int wcd937x_add_slave_components(struct wcd937x_priv *wcd937x,dev_err (dev,"Couldn't parse phandle to qcom,tx-device\n" );return -ENODEV ; } -of_node_get (wcd937x->txnode); +component_match_add_release (dev, matchptr, component_release_of, component_compare_of, wcd937x->txnode);
Signature · 1 line
2.51.2
PATCH 2/3 ASoC: codecs: wcd938x: fix OF node leaks on probe failure
In reply to Johan HovoldThe component match entry release function will drop the references taken while looking up the soundwire OF nodes when the platform device is unbound.
Drop the additional references taken to avoid leaking them on probe failure (e.g. probe deferral) and on driver unbind.
--- sound/soc/codecs/wcd938x.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/wcd938x.c +1 -2
@@ -3465,7 +3465,6 @@ static int wcd938x_add_slave_components(struct wcd938x_priv *wcd938x,return -ENODEV ; } -of_node_get (wcd938x->rxnode);component_match_add_release (dev, matchptr, component_release_of, component_compare_of, wcd938x->rxnode);
@@ -3474,7 +3473,7 @@ static int wcd938x_add_slave_components(struct wcd938x_priv *wcd938x,dev_err (dev,"%s: Tx-device node not defined\n" , __func__);return -ENODEV ; } -of_node_get (wcd938x->txnode); +component_match_add_release (dev, matchptr, component_release_of, component_compare_of, wcd938x->txnode);return 0 ;
Signature · 1 line
2.51.2
PATCH 3/3 ASoC: codecs: wcd939x: fix OF node leaks on probe failure
In reply to Johan HovoldThe component match entry release function will drop the references taken while looking up the soundwire OF nodes when the platform device is unbound.
Drop the additional references taken to avoid leaking them on probe failure (e.g. probe deferral) and on driver unbind.
--- sound/soc/codecs/wcd939x.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/wcd939x.c +1 -2
@@ -3526,7 +3526,6 @@ static int wcd939x_add_slave_components(struct wcd939x_priv *wcd939x,return -ENODEV ; } -of_node_get (wcd939x->rxnode);component_match_add_release (dev, matchptr, component_release_of, component_compare_of, wcd939x->rxnode);
@@ -3535,7 +3534,7 @@ static int wcd939x_add_slave_components(struct wcd939x_priv *wcd939x,dev_err (dev,"%s: Tx-device node not defined\n" , __func__);return -ENODEV ; } -of_node_get (wcd939x->txnode); +component_match_add_release (dev, matchptr, component_release_of, component_compare_of, wcd939x->txnode);return 0 ;
Signature · 1 line
2.51.2
Quoted 5 lines · Johan Hovold
The original wcd938x driver has a couple of OF node reference leaks which have been reproduced in the two later added drivers.
Johan
Thanks for the patches,
Yes, of_parse_phandle() already gets a node refcount, another refcount is redundant and will leak.
LGTM
--srini>
Quoted 10 lines
Johan Hovold (3):
ASoC: codecs: wcd937x: fix OF node leaks on probe failure
ASoC: codecs: wcd938x: fix OF node leaks on probe failure
ASoC: codecs: wcd939x: fix OF node leaks on probe failuresound/soc/codecs/wcd937x.c | 4 ++-- sound/soc/codecs/wcd938x.c | 3 +-- sound/soc/codecs/wcd939x.c | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-)
Mark Brown
maintainerQuoted 6 lines · Johan Hovold
The original wcd938x driver has a couple of OF node reference leaks which have been reproduced in the two later added drivers.
Johan
Quoted 6 lines
Johan Hovold (3):
ASoC: codecs: wcd937x: fix OF node leaks on probe failure
ASoC: codecs: wcd938x: fix OF node leaks on probe failure
ASoC: codecs: wcd939x: fix OF node leaks on probe failure[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: codecs: wcd937x: fix OF node leaks on probe failure
commit: 22a03ca7c20c4ed3a75047709b0ad15160e29d58
[2/3] ASoC: codecs: wcd938x: fix OF node leaks on probe failure
commit: 32ae6ebe171aca9ce10f5790523a9865b6c08b02
[3/3] ASoC: codecs: wcd939x: fix OF node leaks on probe failure
commit: 3ef4d9ede20db39bff34a559b04a1938fb31251eAll 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