Skip to content

Commit 78a9ea4

Browse files
zhengchaoshaokuba-moo
authored andcommitted
net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions()
When dsa_devlink_region_create failed in sja1105_setup_devlink_regions(), priv->regions is not released. Fixes: bf425b8 ("net: dsa: sja1105: expose static config as devlink region") Signed-off-by: Zhengchao Shao <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e40febf commit 78a9ea4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/dsa/sja1105/sja1105_devlink.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ static int sja1105_setup_devlink_regions(struct dsa_switch *ds)
9595
if (IS_ERR(region)) {
9696
while (--i >= 0)
9797
dsa_devlink_region_destroy(priv->regions[i]);
98+
99+
kfree(priv->regions);
98100
return PTR_ERR(region);
99101
}
100102

0 commit comments

Comments
 (0)