All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, fw@strlen.de
Subject: [PATCH net 1/5] netfilter: nf_tables: set dormant flag on hook register failure
Date: Thu, 22 Feb 2024 01:08:39 +0100	[thread overview]
Message-ID: <20240222000843.146665-2-pablo@netfilter.org> (raw)
In-Reply-To: <20240222000843.146665-1-pablo@netfilter.org>

From: Florian Westphal <fw@strlen.de>

We need to set the dormant flag again if we fail to register
the hooks.

During memory pressure hook registration can fail and we end up
with a table marked as active but no registered hooks.

On table/base chain deletion, nf_tables will attempt to unregister
the hook again which yields a warn splat from the nftables core.

Reported-and-tested-by: syzbot+de4025c006ec68ac56fc@syzkaller.appspotmail.com
Fixes: 179d9ba5559a ("netfilter: nf_tables: fix table flag updates")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_tables_api.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index f8e3f70c35bd..90038d778f37 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -1251,6 +1251,7 @@ static int nf_tables_updtable(struct nft_ctx *ctx)
 	return 0;
 
 err_register_hooks:
+	ctx->table->flags |= NFT_TABLE_F_DORMANT;
 	nft_trans_destroy(trans);
 	return ret;
 }
-- 
2.30.2


  reply	other threads:[~2024-02-22  0:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22  0:08 [PATCH net 0/5] Netfilter fixes for net Pablo Neira Ayuso
2024-02-22  0:08 ` Pablo Neira Ayuso [this message]
2024-02-22  9:30   ` [PATCH net 1/5] netfilter: nf_tables: set dormant flag on hook register failure patchwork-bot+netdevbpf
2024-02-22  0:08 ` [PATCH net 2/5] netfilter: nft_flow_offload: reset dst in route object after setting up flow Pablo Neira Ayuso
2024-02-22  0:08 ` [PATCH net 3/5] netfilter: nft_flow_offload: release dst in case direct xmit path is used Pablo Neira Ayuso
2024-02-22  0:08 ` [PATCH net 4/5] netfilter: nf_tables: register hooks last when adding new chain/flowtable Pablo Neira Ayuso
2024-02-22  0:08 ` [PATCH net 5/5] netfilter: nf_tables: use kzalloc for hook allocation Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240222000843.146665-2-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.