OSDN Git Service

netfilter: xt_hashlimit: reduce hashlimit_mutex scope for htable_put()
authorCong Wang <xiyou.wangcong@gmail.com>
Mon, 3 Feb 2020 04:30:52 +0000 (20:30 -0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 7 Feb 2020 14:53:31 +0000 (15:53 +0100)
commitc4a3922d2d20c710f827d3a115ee338e8d0467df
treebfb9ea05404c15a28bb5cd556bb24bd79b665341
parent259039fa30457986929a324d769f543c1509987f
netfilter: xt_hashlimit: reduce hashlimit_mutex scope for htable_put()

It is unnecessary to hold hashlimit_mutex for htable_destroy()
as it is already removed from the global hashtable and its
refcount is already zero.

Also, switch hinfo->use to refcount_t so that we don't have
to hold the mutex until it reaches zero in htable_put().

Reported-and-tested-by: syzbot+adf6c6c2be1c3a718121@syzkaller.appspotmail.com
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/xt_hashlimit.c