[PKT_SCHED]: Correctly handle empty ematch trees
Fixes an invalid memory reference when the basic classifier
is used without any ematches but just actions.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index ebfe2e7..64b047c 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -298,6 +298,11 @@
struct tcf_ematch_tree_hdr *tree_hdr;
struct tcf_ematch *em;
+ if (!rta) {
+ memset(tree, 0, sizeof(*tree));
+ return 0;
+ }
+
if (rtattr_parse_nested(tb, TCA_EMATCH_TREE_MAX, rta) < 0)
goto errout;