Commit 52eb2d52 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Zheng Zengkai
Browse files

net: hns3: Fix a memory leak in an error handling path in 'hclge_handle_error_info_log()'

mainline inclusion
from mainline-master
commit b40d7af7
category: bugfix
bugzilla: 173966
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b40d7af798a0a459d65bd95f34e3dff004eb554a



----------------------------------------------------------------------

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

Fixes: 2e2deee7 ("net: hns3: add the RAS compatibility adaptation solution")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarJiaran Zhang <zhangjiaran@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Reviewed-by: default avatarYongxin Li <liyongxin1@huawei.com>
Signed-off-by: default avatarJunxin Chen <chenjunxin1@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent e7da65a4
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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) {