Skip to content

Commit 6f15a7b

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: stable@vger.kernel.org Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Tested-by: Kamakshi Nellore <nellorex.kamakshi@intel.com> (A Contingent Worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3a21698 commit 6f15a7b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

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

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

23992399
for_each_set_bit(vsi_queue_id, &queuemap, I40E_MAX_VSI_QP) {
2400-
if (vf->adq_enabled) {
2401-
vsi_id = vf->ch[vsi_queue_id / I40E_MAX_VF_VSI].vsi_id;
2400+
u16 idx = vsi_queue_id / I40E_MAX_VF_VSI;
2401+
2402+
if (vf->adq_enabled && idx < vf->num_tc) {
2403+
vsi_id = vf->ch[idx].vsi_id;
24022404
queue_id = (vsi_queue_id % I40E_DEFAULT_QUEUES_PER_VF);
24032405
} else {
24042406
queue_id = vsi_queue_id;

0 commit comments

Comments
 (0)