Message ID | 20170818081043.2130-1-jiri@resnulli.us |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
On Fri, Aug 18, 2017 at 1:10 AM, Jiri Pirko <jiri@resnulli.us> wrote: > From: Jiri Pirko <jiri@mellanox.com> > > 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>
From: Jiri Pirko <jiri@resnulli.us> Date: Fri, 18 Aug 2017 10:10:43 +0200 > From: Jiri Pirko <jiri@mellanox.com> > > 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> Applied, thanks Jiri.
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index ebeeb87..eef6b07 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -190,7 +190,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);