netfilter: xt_recent: Fix attempt to update deleted entry
authorJozsef Kadlecsik <kadlec@mail.kfki.hu>
Fri, 29 Jan 2021 19:57:43 +0000 (20:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Feb 2021 10:02:25 +0000 (11:02 +0100)
commitf035e97f331e6b8f61d95fe1fbb33622405cc7c3
tree0058af4c1e33317bae784f313e17c5626c4d1b1f
parent8032bf2af9ce26b3a362b9711d15f626ab946a74
netfilter: xt_recent: Fix attempt to update deleted entry

[ Upstream commit b1bdde33b72366da20d10770ab7a49fe87b5e190 ]

When both --reap and --update flag are specified, there's a code
path at which the entry to be updated is reaped beforehand,
which then leads to kernel crash. Reap only entries which won't be
updated.

Fixes kernel bugzilla #207773.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=207773
Reported-by: Reindl Harald <h.reindl@thelounge.net>
Fixes: 0079c5aee348 ("netfilter: xt_recent: add an entry reaper")
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/xt_recent.c