Skip to content

Commit b6cb93a

Browse files
lczapnikgregkh
authored andcommitted
i40e: fix idx validation in i40e_validate_queue_map
commit aa68d3c upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 70b0c11 commit b6cb93a

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
@@ -2376,8 +2376,10 @@ static int i40e_validate_queue_map(struct i40e_vf *vf, u16 vsi_id,
23762376
u16 vsi_queue_id, queue_id;
23772377

23782378
for_each_set_bit(vsi_queue_id, &queuemap, I40E_MAX_VSI_QP) {
2379-
if (vf->adq_enabled) {
2380-
vsi_id = vf->ch[vsi_queue_id / I40E_MAX_VF_VSI].vsi_id;
2379+
u16 idx = vsi_queue_id / I40E_MAX_VF_VSI;
2380+
2381+
if (vf->adq_enabled && idx < vf->num_tc) {
2382+
vsi_id = vf->ch[idx].vsi_id;
23812383
queue_id = (vsi_queue_id % I40E_DEFAULT_QUEUES_PER_VF);
23822384
} else {
23832385
queue_id = vsi_queue_id;

0 commit comments

Comments
 (0)