netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions()
@ 2022-12-05  1:21 Zhengchao Shao
  2022-12-06 17:10 ` Vladimir Oltean
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Zhengchao Shao @ 2022-12-05  1:21 UTC (permalink / raw)
  To: netdev, olteanv, andrew, f.fainelli, davem, edumazet, kuba, pabeni
  Cc: weiyongjun1, yuehaibing, shaozhengchao

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(+)

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);
 		}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions()
  2022-12-05  1:21 [PATCH] net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions() Zhengchao Shao
@ 2022-12-06 17:10 ` Vladimir Oltean
  2022-12-06 22:29 ` Florian Fainelli
  2022-12-07  4:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2022-12-06 17:10 UTC (permalink / raw)
  To: Zhengchao Shao
  Cc: netdev, andrew, f.fainelli, davem, edumazet, kuba, pabeni,
	weiyongjun1, yuehaibing

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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions()
  2022-12-05  1:21 [PATCH] net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions() Zhengchao Shao
  2022-12-06 17:10 ` Vladimir Oltean
@ 2022-12-06 22:29 ` Florian Fainelli
  2022-12-07  4:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2022-12-06 22:29 UTC (permalink / raw)
  To: Zhengchao Shao, netdev, olteanv, andrew, davem, edumazet, kuba, pabeni
  Cc: weiyongjun1, yuehaibing

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>
-- 
Florian


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions()
  2022-12-05  1:21 [PATCH] net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions() Zhengchao Shao
  2022-12-06 17:10 ` Vladimir Oltean
  2022-12-06 22:29 ` Florian Fainelli
@ 2022-12-07  4:40 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-07  4:40 UTC (permalink / raw)
  To: shaozhengchao
  Cc: netdev, olteanv, andrew, f.fainelli, davem, edumazet, kuba,
	pabeni, weiyongjun1, yuehaibing

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-07  4:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05  1:21 [PATCH] net: dsa: sja1105: fix memory leak in sja1105_setup_devlink_regions() Zhengchao Shao
2022-12-06 17:10 ` Vladimir Oltean
2022-12-06 22:29 ` Florian Fainelli
2022-12-07  4:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).