* [PATCH net] caif: fix memory leak in cfctrl_linkup_request()
@ 2023-01-04 6:51 Zhengchao Shao
2023-01-04 17:25 ` Jiri Pirko
2023-01-05 9:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Zhengchao Shao @ 2023-01-04 6:51 UTC (permalink / raw)
To: netdev, davem, edumazet, kuba, pabeni
Cc: wsa+renesas, sjur.brandeland, weiyongjun1, yuehaibing,
shaozhengchao
When linktype is unknown or kzalloc failed in cfctrl_linkup_request(),
pkt is not released. Add release process to error path.
Fixes: b482cd2053e3 ("net-caif: add CAIF core protocol stack")
Fixes: 8d545c8f958f ("caif: Disconnect without waiting for response")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
net/caif/cfctrl.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/caif/cfctrl.c b/net/caif/cfctrl.c
index cc405d8c7c30..8480684f2762 100644
--- a/net/caif/cfctrl.c
+++ b/net/caif/cfctrl.c
@@ -269,11 +269,15 @@ int cfctrl_linkup_request(struct cflayer *layer,
default:
pr_warn("Request setup of bad link type = %d\n",
param->linktype);
+ cfpkt_destroy(pkt);
return -EINVAL;
}
req = kzalloc(sizeof(*req), GFP_KERNEL);
- if (!req)
+ if (!req) {
+ cfpkt_destroy(pkt);
return -ENOMEM;
+ }
+
req->client_layer = user_layer;
req->cmd = CFCTRL_CMD_LINK_SETUP;
req->param = *param;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] caif: fix memory leak in cfctrl_linkup_request()
2023-01-04 6:51 [PATCH net] caif: fix memory leak in cfctrl_linkup_request() Zhengchao Shao
@ 2023-01-04 17:25 ` Jiri Pirko
2023-01-05 9:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2023-01-04 17:25 UTC (permalink / raw)
To: Zhengchao Shao
Cc: netdev, davem, edumazet, kuba, pabeni, wsa+renesas,
sjur.brandeland, weiyongjun1, yuehaibing
Wed, Jan 04, 2023 at 07:51:46AM CET, shaozhengchao@huawei.com wrote:
>When linktype is unknown or kzalloc failed in cfctrl_linkup_request(),
>pkt is not released. Add release process to error path.
>
>Fixes: b482cd2053e3 ("net-caif: add CAIF core protocol stack")
>Fixes: 8d545c8f958f ("caif: Disconnect without waiting for response")
>Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] caif: fix memory leak in cfctrl_linkup_request()
2023-01-04 6:51 [PATCH net] caif: fix memory leak in cfctrl_linkup_request() Zhengchao Shao
2023-01-04 17:25 ` Jiri Pirko
@ 2023-01-05 9:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-01-05 9:40 UTC (permalink / raw)
To: Zhengchao Shao
Cc: netdev, davem, edumazet, kuba, pabeni, wsa+renesas,
sjur.brandeland, weiyongjun1, yuehaibing
Hello:
This patch was applied to netdev/net.git (master)
by Paolo Abeni <pabeni@redhat.com>:
On Wed, 4 Jan 2023 14:51:46 +0800 you wrote:
> When linktype is unknown or kzalloc failed in cfctrl_linkup_request(),
> pkt is not released. Add release process to error path.
>
> Fixes: b482cd2053e3 ("net-caif: add CAIF core protocol stack")
> Fixes: 8d545c8f958f ("caif: Disconnect without waiting for response")
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
>
> [...]
Here is the summary with links:
- [net] caif: fix memory leak in cfctrl_linkup_request()
https://git.kernel.org/netdev/net/c/fe69230f0589
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] 3+ messages in thread
end of thread, other threads:[~2023-01-05 9:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-04 6:51 [PATCH net] caif: fix memory leak in cfctrl_linkup_request() Zhengchao Shao
2023-01-04 17:25 ` Jiri Pirko
2023-01-05 9: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