From: Lukasz Czapnik <[email protected]>

Fix condition to check 'greater or equal' to prevent OOB dereference.

Fixes: e284fc280473 ("i40e: Add and delete cloud filter")
Cc: [email protected]
Signed-off-by: Lukasz Czapnik <[email protected]>
Reviewed-by: Aleksandr Loktionov <[email protected]>
Signed-off-by: Przemek Kitszel <[email protected]>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c 
b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index b6db4d78c02d..c85715f75435 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -3603,7 +3603,7 @@ static int i40e_validate_cloud_filter(struct i40e_vf *vf,
 
        /* action_meta is TC number here to which the filter is applied */
        if (!tc_filter->action_meta ||
-           tc_filter->action_meta > vf->num_tc) {
+           tc_filter->action_meta >= vf->num_tc) {
                dev_info(&pf->pdev->dev, "VF %d: Invalid TC number %u\n",
                         vf->vf_id, tc_filter->action_meta);
                goto err;
-- 
2.50.0

Reply via email to