Browse Source

net: sched: fix possible null pointer deref in tcf_block_put

We need to check block for being null in both tcf_block_put and
tcf_block_put_ext.

Fixes: 343723dd51ef ("net: sched: fix clsact init error path")
Reported-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Jiri Pirko 7 years ago
parent
commit
4853f128c1
1 changed files with 2 additions and 0 deletions
  1. 2 0
      net/sched/cls_api.c

+ 2 - 0
net/sched/cls_api.c

@@ -379,6 +379,8 @@ void tcf_block_put(struct tcf_block *block)
 {
 {
 	struct tcf_block_ext_info ei = {0, };
 	struct tcf_block_ext_info ei = {0, };
 
 
+	if (!block)
+		return;
 	tcf_block_put_ext(block, block->q, &ei);
 	tcf_block_put_ext(block, block->q, &ei);
 }
 }