From mboxrd@z Thu Jan 1 00:00:00 1970 From: Davide Caratti Subject: [PATCH net 1/4] net/sched: act_gact: disallow 'goto chain' on fallback control action Date: Sat, 20 Oct 2018 23:33:07 +0200 Message-ID: <02f04ade8a0087781778d02fbb645b1d72f9d777.1540070509.git.dcaratti@redhat.com> References: To: Jiri Pirko , Cong Wang , Jamal Hadi Salim , "David S. Miller" , netdev@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:53898 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726549AbeJUFpF (ORCPT ); Sun, 21 Oct 2018 01:45:05 -0400 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: 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 --- 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 -- 2.17.1