Skip to content

Commit 77a35be

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: stable@vger.kernel.org Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Tested-by: Rafal Romanowski <rafal.romanowski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f8c8e11 commit 77a35be

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

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

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

3773+
#define I40E_MAX_VF_CLOUD_FILTER 0xFF00
3774+
37733775
/**
37743776
* i40e_vc_add_cloud_filter
37753777
* @vf: pointer to the VF info
@@ -3809,6 +3811,14 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)
38093811
goto err_out;
38103812
}
38113813

3814+
if (vf->num_cloud_filters >= I40E_MAX_VF_CLOUD_FILTER) {
3815+
dev_warn(&pf->pdev->dev,
3816+
"VF %d: Max number of filters reached, can't apply cloud filter\n",
3817+
vf->vf_id);
3818+
aq_ret = -ENOSPC;
3819+
goto err_out;
3820+
}
3821+
38123822
cfilter = kzalloc(sizeof(*cfilter), GFP_KERNEL);
38133823
if (!cfilter)
38143824
return -ENOMEM;

0 commit comments

Comments
 (0)