From: Jiri Pirko Date: Wed, 8 Aug 2018 12:04:13 +0000 (+0200) Subject: net: sched: fix block->refcnt decrement X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=63cc5bcc9fc467bbe61cc9ee52509294bdf04c4b;p=openwrt%2Fstaging%2Fblogic.git net: sched: fix block->refcnt decrement Currently the refcnt is never decremented in case the value is not 1. Fix it by adding decrement in case the refcnt is not 1. Reported-by: Vlad Buslov Fixes: f71e0ca4db18 ("net: sched: Avoid implicit chain 0 creation") Signed-off-by: Jiri Pirko Signed-off-by: David S. Miller --- diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 194c2e0b2737..f922ce27ed5e 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -780,6 +780,8 @@ void tcf_block_put_ext(struct tcf_block *block, struct Qdisc *q, block->refcnt--; if (list_empty(&block->chain_list)) kfree(block); + } else { + block->refcnt--; } } EXPORT_SYMBOL(tcf_block_put_ext);