lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1516794175-5679-1-git-send-email-sathya.perla@broadcom.com>
Date:   Wed, 24 Jan 2018 17:12:55 +0530
From:   Sathya Perla <sathya.perla@...adcom.com>
To:     netdev@...r.kernel.org
Cc:     jiri@...nulli.us
Subject: [PATCH] cls_flower: check if filter is in HW before calling fl_hw_destroy_filter()

When a filter cannot be added in HW (i.e, fl_hw_replace_filter() returns
error), the TCA_CLS_FLAGS_IN_HW flag is not set in the filter flags.

This flag (via tc_in_hw()) must be checked before issuing the call
to delete a filter in HW (fl_hw_destroy_filter()) and before issuing the
call to query stats (fl_hw_update_stats()).

Signed-off-by: Sathya Perla <sathya.perla@...adcom.com>
---
 net/sched/cls_flower.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 6132a73..dbcfb52 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -286,7 +286,7 @@ static void __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f)
 
 	idr_remove_ext(&head->handle_idr, f->handle);
 	list_del_rcu(&f->list);
-	if (!tc_skip_hw(f->flags))
+	if (tc_in_hw(f->flags))
 		fl_hw_destroy_filter(tp, f);
 	tcf_unbind_filter(tp, &f->res);
 	if (tcf_exts_get_net(&f->exts))
@@ -951,7 +951,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
 		if (!tc_skip_sw(fold->flags))
 			rhashtable_remove_fast(&head->ht, &fold->ht_node,
 					       head->ht_params);
-		if (!tc_skip_hw(fold->flags))
+		if (tc_in_hw(fold->flags))
 			fl_hw_destroy_filter(tp, fold);
 	}
 
@@ -1170,7 +1170,7 @@ static int fl_dump(struct net *net, struct tcf_proto *tp, void *fh,
 			goto nla_put_failure;
 	}
 
-	if (!tc_skip_hw(f->flags))
+	if (tc_in_hw(f->flags))
 		fl_hw_update_stats(tp, f);
 
 	if (fl_dump_key_val(skb, key->eth.dst, TCA_FLOWER_KEY_ETH_DST,
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ