Skip to content

Commit cb79fa7

Browse files
lczapnikanguy11
authored andcommitted
i40e: add max boundary check for VF filters
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]>
1 parent 877b7e6 commit cb79fa7

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
@@ -3905,6 +3905,8 @@ static int i40e_vc_del_cloud_filter(struct i40e_vf *vf, u8 *msg)
39053905
aq_ret);
39063906
}
39073907

3908+
#define I40E_MAX_VF_CLOUD_FILTER 0xFF00
3909+
39083910
/**
39093911
* i40e_vc_add_cloud_filter
39103912
* @vf: pointer to the VF info
@@ -3944,6 +3946,14 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)
39443946
goto err_out;
39453947
}
39463948

3949+
if (vf->num_cloud_filters >= I40E_MAX_VF_CLOUD_FILTER) {
3950+
dev_warn(&pf->pdev->dev,
3951+
"VF %d: Max number of filters reached, can't apply cloud filter\n",
3952+
vf->vf_id);
3953+
aq_ret = -ENOSPC;
3954+
goto err_out;
3955+
}
3956+
39473957
cfilter = kzalloc(sizeof(*cfilter), GFP_KERNEL);
39483958
if (!cfilter) {
39493959
aq_ret = -ENOMEM;

0 commit comments

Comments
 (0)