Skip to contentSkip to conversation

net: sched: fix p_filter_chain check in tcf_chain_flush

PATCH Applied Jiri Pirko 3 participants 3 messages Aug 18, 2017

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author maintainer
#0 lore raw

PATCH 1/1 net: sched: fix p_filter_chain check in tcf_chain_flush

From: Jiri Pirko <[email protected]>

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")
---
 net/sched/cls_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/cls_api.c +1 -1
index ebeeb87..eef6b07 100644
@@ -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);
Signature · 1 line
2.9.3