netfilter: nf_conntrack_expect: bail out on insert dead expectations

If the NF_CT_EXPECT_DEAD expectation flag is set on, bail out on
insertion. Moreover, add also DEBUG_NET_WARN_ON_ONCE() since this should
not ever happen. This is hardening commit b8b09dc2bf ("netfilter:
nf_conntrack_expect: use conntrack GC to reap expectations").

Signed-off-by: Pablo Neira Ayuso <[email protected]>
This commit is contained in:
Pablo Neira Ayuso committed 2026-08-10 21:20:44 +02:00
1 parent 73df81b38c
commit e765c95faa
1 file changed
+6
+6
View File
@@ -528,6 +528,12 @@ int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
int ret;
spin_lock_bh(&nf_conntrack_expect_lock);
if (expect->flags & NF_CT_EXPECT_DEAD) {
DEBUG_NET_WARN_ON_ONCE(1);
ret = -EINVAL;
goto out;
}
master_help = nfct_help(expect->master);
if (!master_help) {
ret = -ESHUTDOWN;