From: Thomas Graf Date: Tue, 8 Nov 2005 17:39:17 +0000 (-0800) Subject: [PKT_SCHED]: Correctly handle empty ematch trees X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b541ca2c5a3f3f399d6f2ec9da33c1be5a8d8c19;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git [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 Signed-off-by: David S. Miller --- diff --git a/net/sched/ematch.c b/net/sched/ematch.c index ebfe2e7d21b..64b047c6556 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c @@ -298,6 +298,11 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct rtattr *rta, 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;