net: hns3: fix a memory leak issue for hclge_map_unmap_ring_to_vf_vector
authorHuazhong Tan <tanhuazhong@huawei.com>
Tue, 28 May 2019 09:03:02 +0000 (17:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Jan 2020 13:50:52 +0000 (14:50 +0100)
commitd947f064b4feb08ab1e2f43e035ec62827c33581
tree44d5131748899bc2c8c786e3f011ed3a7fd1ecab
parent684880d89a9332a78362ea030e40d6cf0062727e
net: hns3: fix a memory leak issue for hclge_map_unmap_ring_to_vf_vector

[ Upstream commit 49f971bd308571fe466687227130a7082b662d0e ]

When hclge_bind_ring_with_vector() fails,
hclge_map_unmap_ring_to_vf_vector() returns the error
directly, so nobody will free the memory allocated by
hclge_get_ring_chain_from_mbx().

So hclge_free_vector_ring_chain() should be called no matter
hclge_bind_ring_with_vector() fails or not.

Fixes: 84e095d64ed9 ("net: hns3: Change PF to add ring-vect binding & resetQ to mailbox")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c