]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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:45:17 +0000 (16:45 +0100)
commitc3114a5a6d880aa93b7e0e1123d9c9381a8de2e7
treeab5c54d26cbcd104f7cb9ac5b77b3364daa01164
parentd2997d64dfa65082236bca1efd596b6c935daf5e
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