]>
Commit | Line | Data |
---|---|---|
9354405a GKH |
1 | From foo@baz Mon Apr 15 07:47:06 CEST 2019 |
2 | From: Nicolas Dichtel <nicolas.dichtel@6wind.com> | |
3 | Date: Thu, 28 Mar 2019 10:35:06 +0100 | |
4 | Subject: net/sched: fix ->get helper of the matchall cls | |
5 | ||
6 | From: Nicolas Dichtel <nicolas.dichtel@6wind.com> | |
7 | ||
8 | [ Upstream commit 0db6f8befc32c68bb13d7ffbb2e563c79e913e13 ] | |
9 | ||
10 | It returned always NULL, thus it was never possible to get the filter. | |
11 | ||
12 | Example: | |
13 | $ ip link add foo type dummy | |
14 | $ ip link add bar type dummy | |
15 | $ tc qdisc add dev foo clsact | |
16 | $ tc filter add dev foo protocol all pref 1 ingress handle 1234 \ | |
17 | matchall action mirred ingress mirror dev bar | |
18 | ||
19 | Before the patch: | |
20 | $ tc filter get dev foo protocol all pref 1 ingress handle 1234 matchall | |
21 | Error: Specified filter handle not found. | |
22 | We have an error talking to the kernel | |
23 | ||
24 | After: | |
25 | $ tc filter get dev foo protocol all pref 1 ingress handle 1234 matchall | |
26 | filter ingress protocol all pref 1 matchall chain 0 handle 0x4d2 | |
27 | not_in_hw | |
28 | action order 1: mirred (Ingress Mirror to device bar) pipe | |
29 | index 1 ref 1 bind 1 | |
30 | ||
31 | CC: Yotam Gigi <yotamg@mellanox.com> | |
32 | CC: Jiri Pirko <jiri@mellanox.com> | |
33 | Fixes: fd62d9f5c575 ("net/sched: matchall: Fix configuration race") | |
34 | Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> | |
35 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
36 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
37 | --- | |
38 | net/sched/cls_matchall.c | 5 +++++ | |
39 | 1 file changed, 5 insertions(+) | |
40 | ||
41 | --- a/net/sched/cls_matchall.c | |
42 | +++ b/net/sched/cls_matchall.c | |
43 | @@ -125,6 +125,11 @@ static void mall_destroy(struct tcf_prot | |
44 | ||
45 | static void *mall_get(struct tcf_proto *tp, u32 handle) | |
46 | { | |
47 | + struct cls_mall_head *head = rtnl_dereference(tp->root); | |
48 | + | |
49 | + if (head && head->handle == handle) | |
50 | + return head; | |
51 | + | |
52 | return NULL; | |
53 | } | |
54 |