* [Patch net] cls_u32: complete the check for non-forced case in u32_destroy()
@ 2015-08-25 23:38 Cong Wang
2015-08-26 0:03 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2015-08-25 23:38 UTC (permalink / raw)
To: netdev; +Cc: akshat.1984, Cong Wang, Jamal Hadi Salim, Cong Wang
In commit 1e052be69d04 ("net_sched: destroy proto tp when all filters are gone")
I added a check in u32_destroy() to see if all real filters are gone
for each tp, however, that is only done for root_ht, same is needed
for others.
This can be reproduced by the following tc commands:
tc filter add dev eth0 parent 1:0 prio 5 handle 15: protocol ip u32 divisor 256
tc filter add dev eth0 protocol ip parent 1: prio 5 handle 15:2:2 u32
ht 15:2: match ip src 10.0.0.2 flowid 1:10
tc filter add dev eth0 protocol ip parent 1: prio 5 handle 15:2:3 u32
ht 15:2: match ip src 10.0.0.3 flowid 1:10
Fixes: 1e052be69d04 ("net_sched: destroy proto tp when all filters are gone")
Reported-by: Akshat Kakkar <akshat.1984@gmail.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
---
net/sched/cls_u32.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index cab9e9b..4fbb674 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -490,6 +490,19 @@ static bool u32_destroy(struct tcf_proto *tp, bool force)
return false;
}
}
+
+ if (tp_c->refcnt > 1)
+ return false;
+
+ if (tp_c->refcnt == 1) {
+ struct tc_u_hnode *ht;
+
+ for (ht = rtnl_dereference(tp_c->hlist);
+ ht;
+ ht = rtnl_dereference(ht->next))
+ if (!ht_empty(ht))
+ return false;
+ }
}
if (root_ht && --root_ht->refcnt == 0)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch net] cls_u32: complete the check for non-forced case in u32_destroy()
2015-08-25 23:38 [Patch net] cls_u32: complete the check for non-forced case in u32_destroy() Cong Wang
@ 2015-08-26 0:03 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-08-26 0:03 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, akshat.1984, jhs, cwang
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Tue, 25 Aug 2015 16:38:12 -0700
> In commit 1e052be69d04 ("net_sched: destroy proto tp when all filters are gone")
> I added a check in u32_destroy() to see if all real filters are gone
> for each tp, however, that is only done for root_ht, same is needed
> for others.
>
> This can be reproduced by the following tc commands:
>
> tc filter add dev eth0 parent 1:0 prio 5 handle 15: protocol ip u32 divisor 256
> tc filter add dev eth0 protocol ip parent 1: prio 5 handle 15:2:2 u32
> ht 15:2: match ip src 10.0.0.2 flowid 1:10
> tc filter add dev eth0 protocol ip parent 1: prio 5 handle 15:2:3 u32
> ht 15:2: match ip src 10.0.0.3 flowid 1:10
>
> Fixes: 1e052be69d04 ("net_sched: destroy proto tp when all filters are gone")
> Reported-by: Akshat Kakkar <akshat.1984@gmail.com>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> Signed-off-by: Cong Wang <cwang@twopensource.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-26 0:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-25 23:38 [Patch net] cls_u32: complete the check for non-forced case in u32_destroy() Cong Wang
2015-08-26 0:03 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).