ice: fix wrong fallback logic for FDIR
Subsystems (2)
PATCH 1/1 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.
--- drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +4 -3
@@ -1812,7 +1812,7 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) v_ret =VIRTCHNL_STATUS_SUCCESS ; stat->status =VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE ;dev_dbg (dev,"VF %d: set FDIR context failed\n" , vf->vf_id); - goto err_free_conf; + goto err_rem_entry; } ret =ice_vc_fdir_write_fltr (vf, conf, true, is_tun);
@@ -1821,15 +1821,16 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) stat->status =VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE ;dev_err (dev,"VF %d: writing FDIR rule failed, ret:%d\n" , vf->vf_id, ret); - goto err_rem_entry; + goto err_clr_irq; } exit:kfree (stat);return ret; -err_rem_entry: +err_clr_irq:ice_vc_fdir_clear_irq_ctx (vf); +err_rem_entry:ice_vc_fdir_remove_entry (vf, conf, conf->flow_id); err_free_conf:devm_kfree (dev, conf);
Signature · 6 lines
2.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tony Nguyen
maintainerQuoted 8 lines · Simei
When adding a FDIR filter, if
ice_vc_fdir_set_irq_ctxreturns failure, the inserted fdir entry will not be removed and ifice_vc_fdir_write_fltrreturns 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 1f7ea1cd6a37 ("ice: Enable FDIR Configure for AVF")Signed-off-by Simei Su <[email protected]>
I believe your git configuration/author needs to be updated.
WARNING: From:/Signed-off-by: email name mismatch: 'From: "Su, Simei" <[email protected]>' != 'Signed-off-by: Simei Su <[email protected]>'
Quoted 26 lines
--- drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +2
-2@@ -1812,7 +1812,7 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) v_ret =VIRTCHNL_STATUS_SUCCESS ; stat->status =VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE ;dev_dbg (dev,"VF %d: set FDIR context failed\n" , vf->vf_id); - goto err_free_conf; + goto err_rem_entry; } ret =ice_vc_fdir_write_fltr (vf, conf, true, is_tun);@@ -1821,15 +1821,16 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) stat->status =VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE ;dev_err (dev,"VF %d: writing FDIR rule failed, ret:%d\n" , vf->vf_id, ret); - goto err_rem_entry; + goto err_clr_irq; } exit:
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) · line 1836
Quoted 10 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +2
-1kfree (stat);return ret; -err_rem_entry: +err_clr_irq:ice_vc_fdir_clear_irq_ctx (vf); +err_rem_entry:ice_vc_fdir_remove_entry (vf, conf, conf->flow_id); err_free_conf:devm_kfree (dev, conf);
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 17 lines
-----Original Message-----
From: Nguyen, Anthony L <[email protected]>
Sent: Wednesday, March 22, 2023 4:16 AM
To: Su, Simei <[email protected]>; [email protected]
Subject: Re: [Intel-wired-lan] [PATCH net] ice: fix wrong fallback logic for FDIRQuoted 6 lines · Simei
When adding a FDIR filter, if
ice_vc_fdir_set_irq_ctxreturns failure, the inserted fdir entry will not be removed and ifice_vc_fdir_write_fltrreturns 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.
Quoted 7 lines
Quoted 2 lines
Fixes 1f7ea1cd6a37 ("ice: Enable FDIR Configure for AVF")Signed-off-by Simei Su <[email protected]>I believe your git configuration/author needs to be updated.
WARNING: From:/Signed-off-by: email name mismatch: 'From: "Su, Simei" <[email protected]>' != 'Signed-off-by: Simei Su <[email protected]>'
OK, I will update it in patch v2. Thanks.
Br
Simei
Quoted 32 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8
Quoted 11 lines
--- drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +0
-0@@ -1812,7 +1812,7 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8*msg)
Quoted 20 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +3
-2v_ret =VIRTCHNL_STATUS_SUCCESS ; stat->status =VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE ;dev_dbg (dev,"VF %d: set FDIR context failed\n" , vf->vf_id); - goto err_free_conf; + goto err_rem_entry; } ret = ice_vc_fdir_write_fltr(vf, conf, true, is_tun); @@ -1821,15 +1821,16 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) stat->status = VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE;dev_err (dev,"VF %d: writing FDIR rule failed, ret:%d\n" , vf->vf_id, ret); - goto err_rem_entry; + goto err_clr_irq; } exit:kfree (stat);return ret;
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) · line 1836
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +2
-1-err_rem_entry: +err_clr_irq:ice_vc_fdir_clear_irq_ctx (vf); +err_rem_entry:ice_vc_fdir_remove_entry (vf, conf, conf->flow_id); err_free_conf:devm_kfree (dev, conf);
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 1/1 ice: fix wrong fallback logic for FDIR
In reply to Su, SimeiWhen 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.
--- drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +4 -3
@@ -1812,7 +1812,7 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) v_ret =VIRTCHNL_STATUS_SUCCESS ; stat->status =VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE ;dev_dbg (dev,"VF %d: set FDIR context failed\n" , vf->vf_id); - goto err_free_conf; + goto err_rem_entry; } ret =ice_vc_fdir_write_fltr (vf, conf, true, is_tun);
@@ -1821,15 +1821,16 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg) stat->status =VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE ;dev_err (dev,"VF %d: writing FDIR rule failed, ret:%d\n" , vf->vf_id, ret); - goto err_rem_entry; + goto err_clr_irq; } exit:kfree (stat);return ret; -err_rem_entry: +err_clr_irq:ice_vc_fdir_clear_irq_ctx (vf); +err_rem_entry:ice_vc_fdir_remove_entry (vf, conf, conf->flow_id); err_free_conf:devm_kfree (dev, conf);
Signature · 6 lines
2.25.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
Quoted 27 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Simei Su
Sent: środa, 22 marca 2023 03:24
To: [email protected]
Cc: Su, Simei <[email protected]>
Subject: [Intel-wired-lan] [PATCH net, v2] ice: fix wrong fallback logic for FDIRWhen adding a FDIR filter, if
ice_vc_fdir_set_irq_ctxreturns failure, the inserted fdir entry will not be removed and ifice_vc_fdir_write_fltrreturns 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 1f7ea1cd6a37 ("ice: Enable FDIR Configure for AVF")Signed-off-by Simei Su <[email protected]>--- drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +0
-0@@ -1812,7 +1812,7 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan