Skip to content

Commit 3e48041

Browse files
msudheer337anguy11
authored andcommitted
i40e: Fix filter input checks to prevent config with invalid values
Prevent VF from configuring filters with unsupported actions or use REDIRECT action with invalid tc number. Current checks could cause out of bounds access on PF side. Fixes: e284fc2 ("i40e: Add and delete cloud filter") Reviewed-by: Andrii Staikov <andrii.staikov@intel.com> Signed-off-by: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Tested-by: Bharathi Sreenivas <bharathi.sreenivas@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent 8278a6a commit 3e48041

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3521,16 +3521,16 @@ static int i40e_validate_cloud_filter(struct i40e_vf *vf,
35213521
bool found = false;
35223522
int bkt;
35233523

3524-
if (!tc_filter->action) {
3524+
if (tc_filter->action != VIRTCHNL_ACTION_TC_REDIRECT) {
35253525
dev_info(&pf->pdev->dev,
3526-
"VF %d: Currently ADq doesn't support Drop Action\n",
3527-
vf->vf_id);
3526+
"VF %d: ADQ doesn't support this action (%d)\n",
3527+
vf->vf_id, tc_filter->action);
35283528
goto err;
35293529
}
35303530

35313531
/* action_meta is TC number here to which the filter is applied */
35323532
if (!tc_filter->action_meta ||
3533-
tc_filter->action_meta > I40E_MAX_VF_VSI) {
3533+
tc_filter->action_meta > vf->num_tc) {
35343534
dev_info(&pf->pdev->dev, "VF %d: Invalid TC number %u\n",
35353535
vf->vf_id, tc_filter->action_meta);
35363536
goto err;

0 commit comments

Comments
 (0)