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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Mar 2020 15:43:44 +0000 (16:43 +0100)
commit782077bff3a68b5ed7e711d7c58792cb26e8c92c
treeb44d7eb39f4a29504f933c6046191ea0fe7bee6e
parent6c717726f341fd8f39a3ec2dcf5d98d9d28a2769
netfilter: xt_hashlimit: reduce hashlimit_mutex scope for htable_put()

commit c4a3922d2d20c710f827d3a115ee338e8d0467df upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/xt_hashlimit.c