From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: [patch net] net: sched: fix possible null pointer deref in tcf_block_put Date: Thu, 21 Dec 2017 13:13:59 +0100 Message-ID: <20171221121359.3711-1-jiri@resnulli.us> Cc: davem@davemloft.net, jhs@mojatatu.com, xiyou.wangcong@gmail.com, mlxsw@mellanox.com, bhole_prashant_q7@lab.ntt.co.jp To: netdev@vger.kernel.org Return-path: Received: from mail-wr0-f196.google.com ([209.85.128.196]:32780 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751406AbdLUMOB (ORCPT ); Thu, 21 Dec 2017 07:14:01 -0500 Received: by mail-wr0-f196.google.com with SMTP id v21so14286150wrc.0 for ; Thu, 21 Dec 2017 04:14:01 -0800 (PST) Sender: netdev-owner@vger.kernel.org List-ID: From: Jiri Pirko We need to check block for being null in both tcf_block_put and tcf_block_put_ext. Fixes: 343723dd51ef ("net: sched: fix clsact init error path") Reported-by: Prashant Bhole Signed-off-by: Jiri Pirko --- net/sched/cls_api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index b91ea03..b9d63d2 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -379,6 +379,8 @@ void tcf_block_put(struct tcf_block *block) { struct tcf_block_ext_info ei = {0, }; + if (!block) + return; tcf_block_put_ext(block, block->q, &ei); } -- 2.9.5