]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.112/net-sched-fix-get-helper-of-the-matchall-cls.patch
Linux 4.14.112
[thirdparty/kernel/stable-queue.git] / releases / 4.14.112 / net-sched-fix-get-helper-of-the-matchall-cls.patch
CommitLineData
9354405a
GKH
1From foo@baz Mon Apr 15 07:47:06 CEST 2019
2From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
3Date: Thu, 28 Mar 2019 10:35:06 +0100
4Subject: net/sched: fix ->get helper of the matchall cls
5
6From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
7
8[ Upstream commit 0db6f8befc32c68bb13d7ffbb2e563c79e913e13 ]
9
10It returned always NULL, thus it was never possible to get the filter.
11
12Example:
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
19Before the patch:
20$ tc filter get dev foo protocol all pref 1 ingress handle 1234 matchall
21Error: Specified filter handle not found.
22We have an error talking to the kernel
23
24After:
25$ tc filter get dev foo protocol all pref 1 ingress handle 1234 matchall
26filter 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
31CC: Yotam Gigi <yotamg@mellanox.com>
32CC: Jiri Pirko <jiri@mellanox.com>
33Fixes: fd62d9f5c575 ("net/sched: matchall: Fix configuration race")
34Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
35Signed-off-by: David S. Miller <davem@davemloft.net>
36Signed-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