summaryrefslogtreecommitdiffstats
path: root/net/sched/cls_api.c
diff options
context:
space:
mode:
authorCong Wang <xiyou.wangcong@gmail.com>2017-11-03 01:32:08 +0100
committerDavid S. Miller <davem@davemloft.net>2017-11-03 13:31:15 +0100
commit8f918d3ff4a1283a1693afe2b4c8e1844674ca15 (patch)
tree63b2a6ab926d369762e0b7e0bbfaa205a81f4471 /net/sched/cls_api.c
parenttcp: tcp_fragment() should not assume rtx skbs (diff)
downloadlinux-8f918d3ff4a1283a1693afe2b4c8e1844674ca15.tar.xz
linux-8f918d3ff4a1283a1693afe2b4c8e1844674ca15.zip
net_sched: check NULL in tcf_block_put()
Callers of tcf_block_put() could pass NULL so we can't use block->q before checking if block is NULL or not. tcf_block_put_ext() callers are fine, it is always non-NULL. Fixes: 8c4083b30e56 ("net: sched: add block bind/unbind notif. and extended block_get/put") Reported-by: Dave Taht <dave.taht@gmail.com> Cc: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_api.c')
-rw-r--r--net/sched/cls_api.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 3364347bc699..8d1885abee83 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -340,9 +340,6 @@ void tcf_block_put_ext(struct tcf_block *block,
{
struct tcf_chain *chain, *tmp;
- if (!block)
- return;
-
list_for_each_entry_safe(chain, tmp, &block->chain_list, list)
tcf_chain_flush(chain);
@@ -362,6 +359,8 @@ void tcf_block_put(struct tcf_block *block)
{
struct tcf_block_ext_info ei = {0, };
+ if (!block)
+ return;
tcf_block_put_ext(block, NULL, block->q, &ei);
}