]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
net: sched: fix p_filter_chain check in tcf_chain_flush
authorJiri Pirko <jiri@mellanox.com>
Fri, 18 Aug 2017 08:10:43 +0000 (10:10 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Aug 2017 17:19:11 +0000 (10:19 -0700)
The dereference before check is wrong and leads to an oops when
p_filter_chain is NULL. The check needs to be done on the pointer to
prevent NULL dereference.

Fixes: f93e1cdcf42c ("net/sched: fix filter flushing")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_api.c

index 39da0c5801c908e28c4e258319adefde836c6b0c..9fd44c22134783edf3db4f62ff1e8184c455cbd7 100644 (file)
@@ -205,7 +205,7 @@ static void tcf_chain_flush(struct tcf_chain *chain)
 {
        struct tcf_proto *tp;
 
-       if (*chain->p_filter_chain)
+       if (chain->p_filter_chain)
                RCU_INIT_POINTER(*chain->p_filter_chain, NULL);
        while ((tp = rtnl_dereference(chain->filter_chain)) != NULL) {
                RCU_INIT_POINTER(chain->filter_chain, tp->next);