]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
netfilter: nf_tables: release batch on table validation from abort path
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 8 Apr 2024 21:19:28 +0000 (23:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 Apr 2024 11:01:47 +0000 (13:01 +0200)
commit37fc2cde9d19cbc059d6773b7c05247c14effbb3
tree3342abe10cfd997f4b37311e77c3a1a8222360d1
parent48d6bcfc31751ca2e753d901a2d82f27edf8a029
netfilter: nf_tables: release batch on table validation from abort path

commit a45e6889575c2067d3c0212b6bc1022891e65b91 upstream.

Unlike early commit path stage which triggers a call to abort, an
explicit release of the batch is required on abort, otherwise mutex is
released and commit_list remains in place.

Add WARN_ON_ONCE to ensure commit_list is empty from the abort path
before releasing the mutex.

After this patch, commit_list is always assumed to be empty before
grabbing the mutex, therefore

  03c1f1ef1584 ("netfilter: Cleanup nft_net->module_list from nf_tables_exit_net()")

only needs to release the pending modules for registration.

Cc: stable@vger.kernel.org
Fixes: c0391b6ab810 ("netfilter: nf_tables: missing validation from the abort path")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/nf_tables_api.c