net: hns3: add a check for tqp_index in hclge_get_ring_chain_from_mbx()
authorYufeng Mo <moyufeng@huawei.com>
Tue, 9 Feb 2021 09:03:06 +0000 (17:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Feb 2021 10:02:27 +0000 (11:02 +0100)
commit2c0e46258eab60dfa447d0ab7e316478f0f852a3
tree4f532cc0ba2d45238a5ceb8f5a8e16e796f10a78
parent40389ba14d0ee1f7f838e7ba9ba1434eae2aa5df
net: hns3: add a check for tqp_index in hclge_get_ring_chain_from_mbx()

[ Upstream commit 326334aad024a60f46dc5e7dbe1efe32da3ca66f ]

The tqp_index is received from vf, if use it directly,
an out-of-bound issue may be caused, so add a check for
this tqp_index before using it in hclge_get_ring_chain_from_mbx().

Fixes: 84e095d64ed9 ("net: hns3: Change PF to add ring-vect binding & resetQ to mailbox")
Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@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