From e4f0835566600954a4763e15355bf1060498b34f Mon Sep 17 00:00:00 2001 From: Davide Caratti Date: Thu, 14 Feb 2019 13:40:54 +0800 Subject: [PATCH] net/sched: act_gact: disallow 'goto chain' on fallback control action mainline inclusion from mainline-4.20 commit 9469f375ab09 category: bugfix bugzilla: 6145 CVE: NA ------------------------------------------------- in the following command: # tc action add action random 'goto chain x' is allowed only for c1: setting it for c2 makes the kernel crash with NULL pointer dereference, since TC core doesn't initialize the chain handle. Signed-off-by: Davide Caratti Acked-by: Cong Wang Acked-by: Jiri Pirko Signed-off-by: David S. Miller Signed-off-by: Zhiqiang Liu Signed-off-by: Mao Wenan Reviewed-by: Wei Yongjun Signed-off-by: Yang Yingliang --- net/sched/act_gact.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index cd1d9bd32ef9..505138047e5c 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c @@ -88,6 +88,11 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla, p_parm = nla_data(tb[TCA_GACT_PROB]); if (p_parm->ptype >= MAX_RAND) return -EINVAL; + if (TC_ACT_EXT_CMP(p_parm->paction, TC_ACT_GOTO_CHAIN)) { + NL_SET_ERR_MSG(extack, + "goto chain not allowed on fallback"); + return -EINVAL; + } } #endif -- GitLab