提交 0a445ee1 编写于 作者: S Sergey Nemov 提交者: Xie XiuQi

i40e: check queue pairs num in config queues handler

mainline inclusion
from mainline-5.0
commit 3f8af4126269
category: bugfix
bugzilla: 11291
CVE: NA

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

Check if num_queue_pairs number requested by VF is less than
maximum possible value in VIRTCHNL_OP_CONFIG_VSI_QUEUES handler.

Also check if local_vf_id >= 0 in common handler since it is of
int type and can potentially be negative.
Signed-off-by: NSergey Nemov <sergey.nemov@intel.com>
Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: NZhiqiang Liu <liuzhiqiang26@huawei.com>
Reviewed-by: NWenan Mao <maowenan@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 7ae76a44
...@@ -2024,6 +2024,11 @@ static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) ...@@ -2024,6 +2024,11 @@ static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
goto error_param; goto error_param;
} }
if (qci->num_queue_pairs > I40E_MAX_VF_QUEUES) {
aq_ret = I40E_ERR_PARAM;
goto error_param;
}
for (i = 0; i < qci->num_queue_pairs; i++) { for (i = 0; i < qci->num_queue_pairs; i++) {
qpi = &qci->qpair[i]; qpi = &qci->qpair[i];
...@@ -3620,7 +3625,7 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode, ...@@ -3620,7 +3625,7 @@ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode,
int ret; int ret;
pf->vf_aq_requests++; pf->vf_aq_requests++;
if (local_vf_id >= pf->num_alloc_vfs) if (local_vf_id < 0 || local_vf_id >= pf->num_alloc_vfs)
return -EINVAL; return -EINVAL;
vf = &(pf->vf[local_vf_id]); vf = &(pf->vf[local_vf_id]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册