]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
netfilter: nft_immediate: drop chain reference counter on error
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 1 Jan 2024 19:15:33 +0000 (20:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Jan 2024 17:51:15 +0000 (18:51 +0100)
[ Upstream commit b29be0ca8e816119ccdf95cc7d7c7be9bde005f1 ]

In the init path, nft_data_init() bumps the chain reference counter,
decrement it on error by following the error path which calls
nft_data_release() to restore it.

Fixes: 4bedf9eee016 ("netfilter: nf_tables: fix chain binding transaction logic")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/nft_immediate.c

index 7d5b63c5a30af77fcc2d9877231785373904f2ad..d154fe67ca8a6309d0282d6ecd6a74eed39c74d6 100644 (file)
@@ -78,7 +78,7 @@ static int nft_immediate_init(const struct nft_ctx *ctx,
                case NFT_GOTO:
                        err = nf_tables_bind_chain(ctx, chain);
                        if (err < 0)
-                               return err;
+                               goto err1;
                        break;
                default:
                        break;