mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 01:21:28 +00:00
net: hns3: add a check for queue_id in hclge_reset_vf_queue()
The queue_id is received from vf, if use it directly,
an out-of-bound issue may be caused, so add a check for
this queue_id before using it in hclge_reset_vf_queue().
Fixes: 1a426f8b40
("net: hns3: fix the VF queue reset flow error")
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>
This commit is contained in:
parent
eb4733d7cf
commit
67a69f84ca
@ -9813,12 +9813,19 @@ int hclge_reset_tqp(struct hnae3_handle *handle, u16 queue_id)
|
||||
|
||||
void hclge_reset_vf_queue(struct hclge_vport *vport, u16 queue_id)
|
||||
{
|
||||
struct hnae3_handle *handle = &vport->nic;
|
||||
struct hclge_dev *hdev = vport->back;
|
||||
int reset_try_times = 0;
|
||||
int reset_status;
|
||||
u16 queue_gid;
|
||||
int ret;
|
||||
|
||||
if (queue_id >= handle->kinfo.num_tqps) {
|
||||
dev_warn(&hdev->pdev->dev, "Invalid vf queue id(%u)\n",
|
||||
queue_id);
|
||||
return;
|
||||
}
|
||||
|
||||
queue_gid = hclge_covert_handle_qid_global(&vport->nic, queue_id);
|
||||
|
||||
ret = hclge_send_reset_tqp_cmd(hdev, queue_gid, true);
|
||||
|
Loading…
Reference in New Issue
Block a user