Commit 96001921 authored by Navid Emamdoost's avatar Navid Emamdoost Committed by Greg Kroah-Hartman

ieee802154: ca8210: prevent memory leak

[ Upstream commit 6402939e ]

In ca8210_probe the allocated pdata needs to be assigned to
spi_device->dev.platform_data before calling ca8210_get_platform_data.
Othrwise when ca8210_get_platform_data fails pdata cannot be released.
Signed-off-by: default avatarNavid Emamdoost <navid.emamdoost@gmail.com>
Link: https://lore.kernel.org/r/20190917224713.26371-1-navid.emamdoost@gmail.comSigned-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ec3817c6
......@@ -3151,12 +3151,12 @@ static int ca8210_probe(struct spi_device *spi_device)
goto error;
}
priv->spi->dev.platform_data = pdata;
ret = ca8210_get_platform_data(priv->spi, pdata);
if (ret) {
dev_crit(&spi_device->dev, "ca8210_get_platform_data failed\n");
goto error;
}
priv->spi->dev.platform_data = pdata;
ret = ca8210_dev_com_init(priv);
if (ret) {
......
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