* [PATCH] netfilter: nft_dynset: reject DELETE op when set lacks ->delete
@ 2026-11-08 22:32 Noah Weinberger
2026-11-09 2:34 ` Florian Westphal
0 siblings, 1 reply; 2+ messages in thread
From: Noah Weinberger @ 2026-11-08 22:32 UTC (permalink / raw)
To: pablo, fw, kadlec; +Cc: netfilter-devel, netdev, linux-kernel
Hello,
nft_dynset_init() checks that the referenced set implements ->update,
but for NFT_DYNSET_OP_DELETE the packet path calls set->ops->delete
unconditionally. Today the only set type with ->update (nft_set_hash)
also implements ->delete, so the call is always valid - but any future
set type implementing ->update without ->delete turns a rule evaluation
into a NULL function call.
Reject the DELETE op at init time when ->delete is missing, next to the
existing ->update check.
Affected version/commit: mainline fa4ad798f6f681031775266044ba1b0cf3c670bd (v7.4-rc1, 2026-11-07), net/netfilter/nft_dynset.c:98-101 (eval), 209-217 (init).
Longstanding asymmetry.
This was found during an assisted (AI-supported) static source review of
mainline fa4ad798f6f681031775266044ba1b0cf3c670bd (v7.4-rc1, 2026-11-07); every code path cited below was re-verified by the
reporter against that tree. The patch below has NOT been compiled and has
NOT been runtime tested, and no reproducer was produced - the triggering
conditions are described above instead. Please treat this as a report for
verification rather than a battle-tested fix.
Reported-by: Noah Weinberger <noahweinberger2003@proton.me>
---
diff --git a/net/netfilter/nft_dynset.c b/net/netfilter/nft_dynset.c
index fa4da69..5e2bbd0 100644
--- a/net/netfilter/nft_dynset.c
+++ b/net/netfilter/nft_dynset.c
@@ -216,6 +216,9 @@ static int nft_dynset_init(const struct nft_ctx *ctx,
if (priv->op > NFT_DYNSET_OP_DELETE)
return -EOPNOTSUPP;
+ if (priv->op == NFT_DYNSET_OP_DELETE && !set->ops->delete)
+ return -EOPNOTSUPP;
+
timeout = 0;
if (tb[NFTA_DYNSET_TIMEOUT] != NULL) {
if (!(set->flags & NFT_SET_TIMEOUT))
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] netfilter: nft_dynset: reject DELETE op when set lacks ->delete
2026-11-08 22:32 [PATCH] netfilter: nft_dynset: reject DELETE op when set lacks ->delete Noah Weinberger
@ 2026-11-09 2:34 ` Florian Westphal
0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2026-11-09 2:34 UTC (permalink / raw)
To: Noah Weinberger; +Cc: pablo, kadlec, netfilter-devel, netdev, linux-kernel
Noah Weinberger <NoahWeinberger2003@proton.me> wrote:
> Hello,
>
> nft_dynset_init() checks that the referenced set implements ->update,
> but for NFT_DYNSET_OP_DELETE the packet path calls set->ops->delete
> unconditionally. Today the only set type with ->update (nft_set_hash)
> also implements ->delete, so the call is always valid - but any future
> set type implementing ->update without ->delete turns a rule evaluation
> into a NULL function call.
>
> Reject the DELETE op at init time when ->delete is missing, next to the
> existing ->update check.
>
> Affected version/commit: mainline fa4ad798f6f681031775266044ba1b0cf3c670bd (v7.4-rc1, 2026-11-07), net/netfilter/nft_dynset.c:98-101 (eval), 209-217 (init).
> Longstanding asymmetry.
>
> This was found during an assisted (AI-supported) static source review of
> mainline fa4ad798f6f681031775266044ba1b0cf3c670bd (v7.4-rc1, 2026-11-07); every code path cited below was re-verified by the
> reporter against that tree. The patch below has NOT been compiled and has
> NOT been runtime tested, and no reproducer was produced - the triggering
> conditions are described above instead. Please treat this as a report for
> verification rather than a battle-tested fix.
This would have been fine 1 year ago but we no longer have resources
and time to reproduce and verify such "fixes".
Ask your LLM for a reproducer, run it, show a minimal backtrace.
We have LLMs too and we can use them to create enough usless and
time-consuming tasks as-is.
I have a db of +1k reports just like this one.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-09 2:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 22:32 [PATCH] netfilter: nft_dynset: reject DELETE op when set lacks ->delete Noah Weinberger
2026-11-09 2:34 ` Florian Westphal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®