Skip to content

Commit b4a01ac

Browse files
simeisuanguy11
authored andcommitted
ice: fix wrong fallback logic for FDIR
When adding a FDIR filter, if ice_vc_fdir_set_irq_ctx returns failure, the inserted fdir entry will not be removed and if ice_vc_fdir_write_fltr returns failure, the fdir context info for irq handler will not be cleared which may lead to inconsistent or memory leak issue. This patch refines failure cases to resolve this issue. Fixes: 1f7ea1c ("ice: Enable FDIR Configure for AVF") Signed-off-by: Simei Su <[email protected]> Tested-by: Rafal Romanowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 218c597 commit b4a01ac

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,7 +1871,7 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
18711871
v_ret = VIRTCHNL_STATUS_SUCCESS;
18721872
stat->status = VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE;
18731873
dev_dbg(dev, "VF %d: set FDIR context failed\n", vf->vf_id);
1874-
goto err_free_conf;
1874+
goto err_rem_entry;
18751875
}
18761876

18771877
ret = ice_vc_fdir_write_fltr(vf, conf, true, is_tun);
@@ -1880,15 +1880,16 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
18801880
stat->status = VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE;
18811881
dev_err(dev, "VF %d: writing FDIR rule failed, ret:%d\n",
18821882
vf->vf_id, ret);
1883-
goto err_rem_entry;
1883+
goto err_clr_irq;
18841884
}
18851885

18861886
exit:
18871887
kfree(stat);
18881888
return ret;
18891889

1890-
err_rem_entry:
1890+
err_clr_irq:
18911891
ice_vc_fdir_clear_irq_ctx(vf);
1892+
err_rem_entry:
18921893
ice_vc_fdir_remove_entry(vf, conf, conf->flow_id);
18931894
err_free_conf:
18941895
devm_kfree(dev, conf);

0 commit comments

Comments
 (0)