]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
netfilter: nf_tables: release mutex after nft_gc_seq_end from abort path
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 8 Apr 2024 21:19:29 +0000 (23:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 Apr 2024 11:01:47 +0000 (13:01 +0200)
commiteb769ff4e281f751adcaf4f4445cbf30817be139
tree918fe58c7b4233f175f779a515a542986c7261b1
parent37fc2cde9d19cbc059d6773b7c05247c14effbb3
netfilter: nf_tables: release mutex after nft_gc_seq_end from abort path

commit 0d459e2ffb541841714839e8228b845458ed3b27 upstream.

The commit mutex should not be released during the critical section
between nft_gc_seq_begin() and nft_gc_seq_end(), otherwise, async GC
worker could collect expired objects and get the released commit lock
within the same GC sequence.

nf_tables_module_autoload() temporarily releases the mutex to load
module dependencies, then it goes back to replay the transaction again.
Move it at the end of the abort phase after nft_gc_seq_end() is called.

Cc: stable@vger.kernel.org
Fixes: 720344340fb9 ("netfilter: nf_tables: GC transaction race with abort path")
Reported-by: Kuan-Ting Chen <hexrabbit@devco.re>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/nf_tables_api.c