Skip to content

Commit 4e20655

Browse files
ivecerakuba-moo
authored andcommitted
i40e: Fix adding unsupported cloud filters
If a VF tries to add unsupported cloud filter through virtchnl then i40e_add_del_cloud_filter(_big_buf) returns -ENOTSUPP but this error code is stored in 'ret' instead of 'aq_ret' that is used as error code sent back to VF. In this scenario where one of the mentioned functions fails the value of 'aq_ret' is zero so the VF will incorrectly receive a 'success'. Use 'aq_ret' to store return value and remove 'ret' local variable. Additionally fix the issue when filter allocation fails, in this case no notification is sent back to the VF. Fixes: e284fc2 ("i40e: Add and delete cloud filter") Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Ivan Vecera <[email protected]> Tested-by: Rafal Romanowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e50a806 commit 4e20655

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3844,7 +3844,7 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)
38443844
struct i40e_pf *pf = vf->pf;
38453845
struct i40e_vsi *vsi = NULL;
38463846
int aq_ret = 0;
3847-
int i, ret;
3847+
int i;
38483848

38493849
if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
38503850
aq_ret = -EINVAL;
@@ -3868,8 +3868,10 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)
38683868
}
38693869

38703870
cfilter = kzalloc(sizeof(*cfilter), GFP_KERNEL);
3871-
if (!cfilter)
3872-
return -ENOMEM;
3871+
if (!cfilter) {
3872+
aq_ret = -ENOMEM;
3873+
goto err_out;
3874+
}
38733875

38743876
/* parse destination mac address */
38753877
for (i = 0; i < ETH_ALEN; i++)
@@ -3917,13 +3919,13 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)
39173919

39183920
/* Adding cloud filter programmed as TC filter */
39193921
if (tcf.dst_port)
3920-
ret = i40e_add_del_cloud_filter_big_buf(vsi, cfilter, true);
3922+
aq_ret = i40e_add_del_cloud_filter_big_buf(vsi, cfilter, true);
39213923
else
3922-
ret = i40e_add_del_cloud_filter(vsi, cfilter, true);
3923-
if (ret) {
3924+
aq_ret = i40e_add_del_cloud_filter(vsi, cfilter, true);
3925+
if (aq_ret) {
39243926
dev_err(&pf->pdev->dev,
39253927
"VF %d: Failed to add cloud filter, err %pe aq_err %s\n",
3926-
vf->vf_id, ERR_PTR(ret),
3928+
vf->vf_id, ERR_PTR(aq_ret),
39273929
i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
39283930
goto err_free;
39293931
}

0 commit comments

Comments
 (0)