Skip to content

Commit

Permalink
net: hns3: Fix a memory leak in an error handling path in 'hclge_hand…
Browse files Browse the repository at this point in the history
…le_error_info_log()'

If this 'kzalloc()' fails we must free some resources as in all the other
error handling paths of this function.

Fixes: 2e2deee ("net: hns3: add the RAS compatibility adaptation solution")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Jiaran Zhang <zhangjiaran@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Christophe JAILLET authored and David S. Miller committed Jun 21, 2021
1 parent ebe9d9e commit b40d7af
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b40d7af

Please sign in to comment.