Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit acc8b316 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller
Browse files

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: f93e1cdc ("net/sched: fix filter flushing")
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Acked-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 014cd0a3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);