]> 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>
Thu, 28 Mar 2024 13:23:55 +0000 (14:23 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:35:49 +0000 (16:35 +0200)
commit8038ee3c3e5b59bcd78467686db5270c68544e30
tree34c1675d7b8dcdc170592c79b01f9c7e2a5dc100
parentb0b36dcbe0f24383612e5e62bd48df5a8107f7fc
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/nf_tables_api.c