Commit 62f75aaf authored by Dan Carpenter's avatar Dan Carpenter Committed by Mark Brown

ASoC: sgtl5000: use after free in ldo_regulator_register()

The "ldo" variable was dereferenced after free on the error path.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarLiam Girdwood <lrg@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent efb7ac3f
......@@ -875,11 +875,13 @@ static int ldo_regulator_register(struct snd_soc_codec *codec,
ldo->dev = regulator_register(&ldo->desc, codec->dev,
init_data, ldo);
if (IS_ERR(ldo->dev)) {
int ret = PTR_ERR(ldo->dev);
dev_err(codec->dev, "failed to register regulator\n");
kfree(ldo->desc.name);
kfree(ldo);
return PTR_ERR(ldo->dev);
return ret;
}
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment