Skip to content

Commit aa68d3c

Browse files
lczapnikanguy11
authored andcommitted
i40e: fix idx validation in i40e_validate_queue_map
Ensure idx is within range of active/initialized TCs when iterating over vf->ch[idx] in i40e_validate_queue_map(). Fixes: c27eac4 ("i40e: Enable ADq and create queue channel/s on VF") Cc: [email protected] Signed-off-by: Lukasz Czapnik <[email protected]> Reviewed-by: Aleksandr Loktionov <[email protected]> Signed-off-by: Przemek Kitszel <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Kamakshi Nellore <[email protected]> (A Contingent Worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent 55d2256 commit aa68d3c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2466,8 +2466,10 @@ static int i40e_validate_queue_map(struct i40e_vf *vf, u16 vsi_id,
24662466
u16 vsi_queue_id, queue_id;
24672467

24682468
for_each_set_bit(vsi_queue_id, &queuemap, I40E_MAX_VSI_QP) {
2469-
if (vf->adq_enabled) {
2470-
vsi_id = vf->ch[vsi_queue_id / I40E_MAX_VF_VSI].vsi_id;
2469+
u16 idx = vsi_queue_id / I40E_MAX_VF_VSI;
2470+
2471+
if (vf->adq_enabled && idx < vf->num_tc) {
2472+
vsi_id = vf->ch[idx].vsi_id;
24712473
queue_id = (vsi_queue_id % I40E_DEFAULT_QUEUES_PER_VF);
24722474
} else {
24732475
queue_id = vsi_queue_id;

0 commit comments

Comments
 (0)