Skip to content

Commit 9176e18

Browse files
lczapnikgregkh
authored andcommitted
i40e: add max boundary check for VF filters
commit cb79fa7 upstream. There is no check for max filters that VF can request. Add it. Fixes: e284fc2 ("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]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Rafal Romanowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a88c1b2 commit 9176e18

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3665,6 +3665,8 @@ static int i40e_vc_del_cloud_filter(struct i40e_vf *vf, u8 *msg)
36653665
aq_ret);
36663666
}
36673667

3668+
#define I40E_MAX_VF_CLOUD_FILTER 0xFF00
3669+
36683670
/**
36693671
* i40e_vc_add_cloud_filter
36703672
* @vf: pointer to the VF info
@@ -3704,6 +3706,14 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)
37043706
goto err_out;
37053707
}
37063708

3709+
if (vf->num_cloud_filters >= I40E_MAX_VF_CLOUD_FILTER) {
3710+
dev_warn(&pf->pdev->dev,
3711+
"VF %d: Max number of filters reached, can't apply cloud filter\n",
3712+
vf->vf_id);
3713+
aq_ret = -ENOSPC;
3714+
goto err_out;
3715+
}
3716+
37073717
cfilter = kzalloc(sizeof(*cfilter), GFP_KERNEL);
37083718
if (!cfilter)
37093719
return -ENOMEM;

0 commit comments

Comments
 (0)