* [PATCH] net: hns3: Fix a memory leak in an error handling path in 'hclge_handle_error_info_log()'
@ 2021-06-20 9:49 Christophe JAILLET
2021-06-21 12:41 ` zhangjiaran
2021-06-21 21:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2021-06-20 9:49 UTC (permalink / raw)
To: yisen.zhuang, salil.mehta, davem, kuba, huangguangbin2,
tanhuazhong, zhangjiaran, moyufeng, lipeng321
Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET
If this 'kzalloc()' fails we must free some resources as in all the other
error handling paths of this function.
Fixes: 2e2deee7618b ("net: hns3: add the RAS compatibility adaptation solution")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
index bad9fda19398..ec9a7f8bc3fe 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
@@ -2330,8 +2330,10 @@ int hclge_handle_error_info_log(struct hnae3_ae_dev *ae_dev)
buf_size = buf_len / sizeof(u32);
desc_data = kzalloc(buf_len, GFP_KERNEL);
- if (!desc_data)
- return -ENOMEM;
+ if (!desc_data) {
+ ret = -ENOMEM;
+ goto err_desc;
+ }
buf = kzalloc(buf_len, GFP_KERNEL);
if (!buf) {
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: hns3: Fix a memory leak in an error handling path in 'hclge_handle_error_info_log()'
2021-06-20 9:49 [PATCH] net: hns3: Fix a memory leak in an error handling path in 'hclge_handle_error_info_log()' Christophe JAILLET
@ 2021-06-21 12:41 ` zhangjiaran
2021-06-21 21:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: zhangjiaran @ 2021-06-21 12:41 UTC (permalink / raw)
To: Christophe JAILLET, yisen.zhuang, salil.mehta, davem, kuba,
huangguangbin2, tanhuazhong, moyufeng, lipeng321
Cc: netdev, linux-kernel, kernel-janitors
在 2021/6/20 17:49, Christophe JAILLET 写道:
> If this 'kzalloc()' fails we must free some resources as in all the other
> error handling paths of this function.
>
> Fixes: 2e2deee7618b ("net: hns3: add the RAS compatibility adaptation solution")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
> index bad9fda19398..ec9a7f8bc3fe 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
> @@ -2330,8 +2330,10 @@ int hclge_handle_error_info_log(struct hnae3_ae_dev *ae_dev)
> buf_size = buf_len / sizeof(u32);
>
> desc_data = kzalloc(buf_len, GFP_KERNEL);
> - if (!desc_data)
> - return -ENOMEM;
> + if (!desc_data) {
> + ret = -ENOMEM;
> + goto err_desc;
> + }
>
> buf = kzalloc(buf_len, GFP_KERNEL);
> if (!buf) {
>
Reviewed-by: Jiaran Zhang <zhangjiaran@huawei.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: hns3: Fix a memory leak in an error handling path in 'hclge_handle_error_info_log()'
2021-06-20 9:49 [PATCH] net: hns3: Fix a memory leak in an error handling path in 'hclge_handle_error_info_log()' Christophe JAILLET
2021-06-21 12:41 ` zhangjiaran
@ 2021-06-21 21:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-21 21:40 UTC (permalink / raw)
To: Christophe JAILLET
Cc: yisen.zhuang, salil.mehta, davem, kuba, huangguangbin2,
tanhuazhong, zhangjiaran, moyufeng, lipeng321, netdev,
linux-kernel, kernel-janitors
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Sun, 20 Jun 2021 11:49:40 +0200 you wrote:
> If this 'kzalloc()' fails we must free some resources as in all the other
> error handling paths of this function.
>
> Fixes: 2e2deee7618b ("net: hns3: add the RAS compatibility adaptation solution")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Here is the summary with links:
- net: hns3: Fix a memory leak in an error handling path in 'hclge_handle_error_info_log()'
https://git.kernel.org/netdev/net-next/c/b40d7af798a0
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:[~2021-06-21 21:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-20 9:49 [PATCH] net: hns3: Fix a memory leak in an error handling path in 'hclge_handle_error_info_log()' Christophe JAILLET
2021-06-21 12:41 ` zhangjiaran
2021-06-21 21: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).