diff mbox series

[ovs-dev] netdev-tc-offloads: Don't delete ufid mapping if fail to delete filter

Message ID 20201014103104.75530-1-roid@nvidia.com
State Accepted
Headers show
Series [ovs-dev] netdev-tc-offloads: Don't delete ufid mapping if fail to delete filter | expand

Commit Message

Roi Dayan Oct. 14, 2020, 10:31 a.m. UTC
From: Jianbo Liu <jianbol@nvidia.com>

tc_replace_flower may fail, so the return value must be checked.
If not zero, ufid can't be deleted. Otherwise the operations on this
filter may fail because its ufid is not found.

Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
---
 lib/netdev-offload-tc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Simon Horman Oct. 24, 2020, 6:56 a.m. UTC | #1
On Wed, Oct 14, 2020 at 01:31:04PM +0300, Roi Dayan wrote:
> From: Jianbo Liu <jianbol@nvidia.com>
> 
> tc_replace_flower may fail, so the return value must be checked.
> If not zero, ufid can't be deleted. Otherwise the operations on this
> filter may fail because its ufid is not found.
> 
> Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
> Reviewed-by: Roi Dayan <roid@nvidia.com>

Thanks and sorry for the delay.

This looks good to me and I have applied it to master, branch-2.14 and
branch-2.14. Please let me know if backports should also be considered
for older branches.

> ---
>  lib/netdev-offload-tc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
> index 18ff380f9861..e828a8683910 100644
> --- a/lib/netdev-offload-tc.c
> +++ b/lib/netdev-offload-tc.c
> @@ -198,7 +198,9 @@ del_filter_and_ufid_mapping(struct tcf_id *id, const ovs_u128 *ufid)
>      int err;
>  
>      err = tc_del_filter(id);
> -    del_ufid_tc_mapping(ufid);
> +    if (!err) {
> +        del_ufid_tc_mapping(ufid);
> +    }
>      return err;
>  }
>  
> -- 
> 2.8.4
>
diff mbox series

Patch

diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
index 18ff380f9861..e828a8683910 100644
--- a/lib/netdev-offload-tc.c
+++ b/lib/netdev-offload-tc.c
@@ -198,7 +198,9 @@  del_filter_and_ufid_mapping(struct tcf_id *id, const ovs_u128 *ufid)
     int err;
 
     err = tc_del_filter(id);
-    del_ufid_tc_mapping(ufid);
+    if (!err) {
+        del_ufid_tc_mapping(ufid);
+    }
     return err;
 }