From: Jiri Pirko Subject: [patch net] net: sched: fix error path in tcf_proto_create() when modules are not configured Date: Fri, 11 May 2018 17:45:32 +0200 Message-ID: <20180511154532.2391-1-jiri@resnulli.us> Cc: davem@davemloft.net, jhs@mojatatu.com, xiyou.wangcong@gmail.com, mlxsw@mellanox.com To: netdev@vger.kernel.org Return-path: Received: from mail-wr0-f195.google.com ([209.85.128.195]:44299 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751263AbeEKPpj (ORCPT ); Fri, 11 May 2018 11:45:39 -0400 Received: by mail-wr0-f195.google.com with SMTP id y15-v6so5776300wrg.11 for ; Fri, 11 May 2018 08:45:38 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: From: Jiri Pirko In case modules are not configured, error out when tp->ops is null and prevent later null pointer dereference. Fixes: 33a48927c193 ("sched: push TC filter protocol creation into a separate function") Signed-off-by: Jiri Pirko --- net/sched/cls_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index b66754f52a9f..963e4bf0aab8 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -152,8 +152,8 @@ static struct tcf_proto *tcf_proto_create(const char *kind, u32 protocol, NL_SET_ERR_MSG(extack, "TC classifier not found"); err = -ENOENT; } - goto errout; #endif + goto errout; } tp->classify = tp->ops->classify; tp->protocol = protocol; -- 2.14.3