Skip to content

Commit 2dd2f2e

Browse files
ivecerasnajpa
authored andcommitted
i40e: Fix adding unsupported cloud filters
[ Upstream commit 4e20655 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 8f71a7f commit 2dd2f2e

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
@@ -3904,7 +3904,7 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)
39043904
struct i40e_pf *pf = vf->pf;
39053905
struct i40e_vsi *vsi = NULL;
39063906
int aq_ret = 0;
3907-
int i, ret;
3907+
int i;
39083908

39093909
if (!i40e_sync_vf_state(vf, I40E_VF_STATE_ACTIVE)) {
39103910
aq_ret = -EINVAL;
@@ -3928,8 +3928,10 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)
39283928
}
39293929

39303930
cfilter = kzalloc(sizeof(*cfilter), GFP_KERNEL);
3931-
if (!cfilter)
3932-
return -ENOMEM;
3931+
if (!cfilter) {
3932+
aq_ret = -ENOMEM;
3933+
goto err_out;
3934+
}
39333935

39343936
/* parse destination mac address */
39353937
for (i = 0; i < ETH_ALEN; i++)
@@ -3977,13 +3979,13 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)
39773979

39783980
/* Adding cloud filter programmed as TC filter */
39793981
if (tcf.dst_port)
3980-
ret = i40e_add_del_cloud_filter_big_buf(vsi, cfilter, true);
3982+
aq_ret = i40e_add_del_cloud_filter_big_buf(vsi, cfilter, true);
39813983
else
3982-
ret = i40e_add_del_cloud_filter(vsi, cfilter, true);
3983-
if (ret) {
3984+
aq_ret = i40e_add_del_cloud_filter(vsi, cfilter, true);
3985+
if (aq_ret) {
39843986
dev_err(&pf->pdev->dev,
39853987
"VF %d: Failed to add cloud filter, err %pe aq_err %s\n",
3986-
vf->vf_id, ERR_PTR(ret),
3988+
vf->vf_id, ERR_PTR(aq_ret),
39873989
i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
39883990
goto err_free;
39893991
}

0 commit comments

Comments
 (0)