Message ID | 20221205012132.2110979-1-shaozhengchao@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 78a9ea43fc1a7c06a420b132d2d47cbf4344a5df |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions() | expand |
On Mon, Dec 05, 2022 at 09:21:32AM +0800, Zhengchao Shao wrote: > When dsa_devlink_region_create failed in sja1105_setup_devlink_regions(), > priv->regions is not released. > > Fixes: bf425b82059e ("net: dsa: sja1105: expose static config as devlink region") > Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> > --- Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
On 12/4/22 17:21, Zhengchao Shao wrote: > When dsa_devlink_region_create failed in sja1105_setup_devlink_regions(), > priv->regions is not released. > > Fixes: bf425b82059e ("net: dsa: sja1105: expose static config as devlink region") > Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Hello: This patch was applied to netdev/net.git (master) by Jakub Kicinski <kuba@kernel.org>: On Mon, 5 Dec 2022 09:21:32 +0800 you wrote: > When dsa_devlink_region_create failed in sja1105_setup_devlink_regions(), > priv->regions is not released. > > Fixes: bf425b82059e ("net: dsa: sja1105: expose static config as devlink region") > Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> > --- > drivers/net/dsa/sja1105/sja1105_devlink.c | 2 ++ > 1 file changed, 2 insertions(+) Here is the summary with links: - net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions() https://git.kernel.org/netdev/net/c/78a9ea43fc1a You are awesome, thank you!
diff --git a/drivers/net/dsa/sja1105/sja1105_devlink.c b/drivers/net/dsa/sja1105/sja1105_devlink.c index 10c6fea1227f..bdbbff2a7909 100644 --- a/drivers/net/dsa/sja1105/sja1105_devlink.c +++ b/drivers/net/dsa/sja1105/sja1105_devlink.c @@ -95,6 +95,8 @@ static int sja1105_setup_devlink_regions(struct dsa_switch *ds) if (IS_ERR(region)) { while (--i >= 0) dsa_devlink_region_destroy(priv->regions[i]); + + kfree(priv->regions); return PTR_ERR(region); }
When dsa_devlink_region_create failed in sja1105_setup_devlink_regions(), priv->regions is not released. Fixes: bf425b82059e ("net: dsa: sja1105: expose static config as devlink region") Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> --- drivers/net/dsa/sja1105/sja1105_devlink.c | 2 ++ 1 file changed, 2 insertions(+)