net: sched: fix p_filter_chain check in tcf_chain_flush
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: f93e1cdcf4
("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>
This commit is contained in:
parent
014cd0a368
commit
acc8b31665
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue