mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 05:27:07 +02:00
net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions()
[ Upstream commit78a9ea43fc] When dsa_devlink_region_create failed in sja1105_setup_devlink_regions(), priv->regions is not released. Fixes:bf425b8205("net: dsa: sja1105: expose static config as devlink region") Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20221205012132.2110979-1-shaozhengchao@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
8e3f9ac009
commit
4be43e46c3
|
|
@ -95,6 +95,8 @@ static int sja1105_setup_devlink_regions(struct dsa_switch *ds)
|
||||||
if (IS_ERR(region)) {
|
if (IS_ERR(region)) {
|
||||||
while (--i >= 0)
|
while (--i >= 0)
|
||||||
dsa_devlink_region_destroy(priv->regions[i]);
|
dsa_devlink_region_destroy(priv->regions[i]);
|
||||||
|
|
||||||
|
kfree(priv->regions);
|
||||||
return PTR_ERR(region);
|
return PTR_ERR(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user