Skip to contentSkip to conversation

net_sched: fix a missing refcnt in tcindex_init()

PATCH Applied Cong Wang 2 participants 2 messages Apr 3, 2020

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 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 [email protected]
Fixes 304e024216a8 ("net_sched: add a temporary refcnt for struct tcindex_data")
Cc Jamal Hadi Salim <[email protected]>
Cc Jiri Pirko <[email protected]>
Cc Paul E. McKenney <[email protected]>
---
 net/sched/cls_tcindex.c | 1 +
 1 file changed, 1 insertion(+)
net/sched/cls_tcindex.c +1 -0
index 065345832a69..61e95029c18f 100644
@@ -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;
Signature · 1 line
2.21.1
maintainer Applied
#1 lore raw

From: Cong Wang <[email protected]>
Date: Thu, 2 Apr 2020 20:58:51 -0700

Quoted 10 lines

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 [email protected]
Fixes 304e024216a8 ("net_sched: add a temporary refcnt for struct tcindex_data")
Cc Jamal Hadi Salim <[email protected]>
Cc Jiri Pirko <[email protected]>
Cc Paul E. McKenney <[email protected]>

Applied, thanks Cong.