net_sched: check NULL in tcf_block_put()
Subsystems (3)
PATCH 1/1 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 <[email protected]>
Cc Jiri Pirko <[email protected]>
Signed-off-by Cong Wang <[email protected]>
--- net/sched/cls_api.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/sched/cls_api.c +2 -3
@@ -340,9 +340,6 @@ void tcf_block_put_ext(struct tcf_block *block, {struct tcf_chain *chain, *tmp; -if (!block) -return ; -tcf_block_offload_unbind (block, q, ei);list_for_each_entry_safe (chain, tmp, &block->chain_list, list)
@@ -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); }
Signature · 1 line
2.13.0
Quoted 11 lines · Fri, Nov 03, 2017 at 01:32:08AM CET, [email protected] wrote:
Callers of
tcf_block_put()could pass NULL so
we can't useblock->qbefore 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 <[email protected]>Cc Jiri Pirko <[email protected]>Signed-off-by Cong Wang <[email protected]>
Reviewed-by Jiri Pirko <[email protected]>
From: Cong Wang <[email protected]>
Date: Thu, 2 Nov 2017 17:32:08 -0700
Quoted 11 lines
Callers of
tcf_block_put()could pass NULL so
we can't useblock->qbefore 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 <[email protected]>Cc Jiri Pirko <[email protected]>Signed-off-by Cong Wang <[email protected]>
Applied, thanks Cong.