]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.35/net-sched-fix-get-helper-of-the-matchall-cls.patch
Linux 4.19.35
[thirdparty/kernel/stable-queue.git] / releases / 4.19.35 / net-sched-fix-get-helper-of-the-matchall-cls.patch
CommitLineData
a9fba688
SL
1From 2e627787f888b74c68e395afb99fc532bf44dedc Mon Sep 17 00:00:00 2001
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
6[ Upstream commit 0db6f8befc32c68bb13d7ffbb2e563c79e913e13 ]
7
8It returned always NULL, thus it was never possible to get the filter.
9
10Example:
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
17Before the patch:
18$ tc filter get dev foo protocol all pref 1 ingress handle 1234 matchall
19Error: Specified filter handle not found.
20We have an error talking to the kernel
21
22After:
23$ tc filter get dev foo protocol all pref 1 ingress handle 1234 matchall
24filter 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
29CC: Yotam Gigi <yotamg@mellanox.com>
30CC: Jiri Pirko <jiri@mellanox.com>
31Fixes: fd62d9f5c575 ("net/sched: matchall: Fix configuration race")
32Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
33Signed-off-by: David S. Miller <davem@davemloft.net>
34Signed-off-by: Sasha Levin <sashal@kernel.org>
35---
36 net/sched/cls_matchall.c | 5 +++++
37 1 file changed, 5 insertions(+)
38
39diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c
40index 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--
562.19.1
57