diff options
| author | Lukasz Czapnik <[email protected]> | 2025-08-13 10:45:16 +0000 |
|---|---|---|
| committer | Tony Nguyen <[email protected]> | 2025-09-18 22:46:29 +0000 |
| commit | cb79fa7118c150c3c76a327894bb2eb878c02619 (patch) | |
| tree | d9ad74ec93f18f7d3a1dd9945434d7733c311159 | |
| parent | i40e: fix validation of VF state in get resources (diff) | |
| download | kernel-cb79fa7118c150c3c76a327894bb2eb878c02619.tar.gz kernel-cb79fa7118c150c3c76a327894bb2eb878c02619.zip | |
i40e: add max boundary check for VF filters
There is no check for max filters that VF can request. Add it.
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]>
Reviewed-by: Simon Horman <[email protected]>
Tested-by: Rafal Romanowski <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>
| -rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index 5ef3dc43a8a0..f29941c00342 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -3905,6 +3905,8 @@ err: aq_ret); } +#define I40E_MAX_VF_CLOUD_FILTER 0xFF00 + /** * i40e_vc_add_cloud_filter * @vf: pointer to the VF info @@ -3944,6 +3946,14 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg) goto err_out; } + if (vf->num_cloud_filters >= I40E_MAX_VF_CLOUD_FILTER) { + dev_warn(&pf->pdev->dev, + "VF %d: Max number of filters reached, can't apply cloud filter\n", + vf->vf_id); + aq_ret = -ENOSPC; + goto err_out; + } + cfilter = kzalloc(sizeof(*cfilter), GFP_KERNEL); if (!cfilter) { aq_ret = -ENOMEM; |
