Skip to content

Commit 6402939

Browse files
NavidemStefan-Schmidt
authored andcommitted
ieee802154: ca8210: prevent memory leak
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>
1 parent 21a045e commit 6402939

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: drivers/net/ieee802154/ca8210.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3152,12 +3152,12 @@ static int ca8210_probe(struct spi_device *spi_device)
31523152
goto error;
31533153
}
31543154

3155+
priv->spi->dev.platform_data = pdata;
31553156
ret = ca8210_get_platform_data(priv->spi, pdata);
31563157
if (ret) {
31573158
dev_crit(&spi_device->dev, "ca8210_get_platform_data failed\n");
31583159
goto error;
31593160
}
3160-
priv->spi->dev.platform_data = pdata;
31613161

31623162
ret = ca8210_dev_com_init(priv);
31633163
if (ret) {

0 commit comments

Comments
 (0)