From: Davide Caratti Date: Sat, 20 Oct 2018 21:33:07 +0000 (+0200) Subject: net/sched: act_gact: disallow 'goto chain' on fallback control action X-Git-Tag: v5.15~7778^2~18^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9469f375ab0900075bd3f1f58083c19b0224d978;p=platform%2Fkernel%2Flinux-starfive.git net/sched: act_gact: disallow 'goto chain' on fallback control action 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 --- diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index c89a7fa..b61c20e 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