From: Cong Wang Date: Fri, 3 Apr 2020 03:58:51 +0000 (-0700) Subject: net_sched: fix a missing refcnt in tcindex_init() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a8eab6d35e22f4f21471f16147be79529cd6aaf7;p=linux.git net_sched: fix a missing refcnt in tcindex_init() The initial refcnt of struct tcindex_data should be 1, it is clear that I forgot to set it to 1 in tcindex_init(). This leads to a dec-after-zero warning. Reported-by: syzbot+8325e509a1bf83ec741d@syzkaller.appspotmail.com Fixes: 304e024216a8 ("net_sched: add a temporary refcnt for struct tcindex_data") Cc: Jamal Hadi Salim Cc: Jiri Pirko Cc: Paul E. McKenney Signed-off-by: Cong Wang Signed-off-by: David S. Miller --- diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 065345832a697..61e95029c18f5 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c @@ -151,6 +151,7 @@ static int tcindex_init(struct tcf_proto *tp) p->mask = 0xffff; p->hash = DEFAULT_HASH_SIZE; p->fall_through = 1; + refcount_set(&p->refcnt, 1); /* Paired with tcindex_destroy_work() */ rcu_assign_pointer(tp->root, p); return 0;