Skip to content

Commit

Permalink
ieee802154: ca8210: prevent memory leak
Browse files Browse the repository at this point in the history
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: Navid Emamdoost <navid.emamdoost@gmail.com>
Link: https://lore.kernel.org/r/20190917224713.26371-1-navid.emamdoost@gmail.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
  • Loading branch information
Navidem authored and Stefan-Schmidt committed Sep 27, 2019
1 parent 21a045e commit 6402939
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ieee802154/ca8210.c
Original file line number Diff line number Diff line change
Expand Up @@ -3152,12 +3152,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) {
Expand Down

0 comments on commit 6402939

Please sign in to comment.