]>
Commit | Line | Data |
---|---|---|
a9fba688 SL |
1 | From 2e627787f888b74c68e395afb99fc532bf44dedc Mon Sep 17 00:00:00 2001 |
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 | [ Upstream commit 0db6f8befc32c68bb13d7ffbb2e563c79e913e13 ] | |
7 | ||
8 | It returned always NULL, thus it was never possible to get the filter. | |
9 | ||
10 | Example: | |
11 | $ ip link add foo type dummy | |
12 | $ ip link add bar type dummy | |
13 | $ tc qdisc add dev foo clsact | |
14 | $ tc filter add dev foo protocol all pref 1 ingress handle 1234 \ | |
15 | matchall action mirred ingress mirror dev bar | |
16 | ||
17 | Before the patch: | |
18 | $ tc filter get dev foo protocol all pref 1 ingress handle 1234 matchall | |
19 | Error: Specified filter handle not found. | |
20 | We have an error talking to the kernel | |
21 | ||
22 | After: | |
23 | $ tc filter get dev foo protocol all pref 1 ingress handle 1234 matchall | |
24 | filter ingress protocol all pref 1 matchall chain 0 handle 0x4d2 | |
25 | not_in_hw | |
26 | action order 1: mirred (Ingress Mirror to device bar) pipe | |
27 | index 1 ref 1 bind 1 | |
28 | ||
29 | CC: Yotam Gigi <yotamg@mellanox.com> | |
30 | CC: Jiri Pirko <jiri@mellanox.com> | |
31 | Fixes: fd62d9f5c575 ("net/sched: matchall: Fix configuration race") | |
32 | Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> | |
33 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
34 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
35 | --- | |
36 | net/sched/cls_matchall.c | 5 +++++ | |
37 | 1 file changed, 5 insertions(+) | |
38 | ||
39 | diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c | |
40 | index 856fa79d4ffd..621bc1d5b057 100644 | |
41 | --- a/net/sched/cls_matchall.c | |
42 | +++ b/net/sched/cls_matchall.c | |
43 | @@ -126,6 +126,11 @@ static void mall_destroy(struct tcf_proto *tp, struct netlink_ext_ack *extack) | |
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 | ||
55 | -- | |
56 | 2.19.1 | |
57 |