Skip to contentSkip to conversation

netfilter: xt_cluster: reject template conntracks in hash match

PATCH New Ren Wei 1 participant 1 message Jun 11 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Ren Wei

author
#1 lore raw

PATCH 1/1 netfilter: xt_cluster: reject template conntracks in hash match

In reply to a message not in the archive

From: Wyatt Feng <[email protected]>

xt_cluster_mt() treats any non-NULL nf_ct_get() result as a fully initialized conntrack and passes it to xt_cluster_hash().

This causes a state confusion bug when the raw table CT target attaches a template conntrack to skb->_nfct before normal conntrack processing. Templates carry IPS_TEMPLATE status but do not have a valid tuple for hashing yet, so xt_cluster_hash() can hit its WARN_ON() path on the zeroed l3num field.

Reject template conntracks before hashing them. This matches existing netfilter handling for template objects and avoids hashing incomplete conntrack state.

Fixes 0269ea493734 ("netfilter: xtables: add cluster match")
Assisted-by Codex:GPT-5.4
---
 net/netfilter/xt_cluster.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/xt_cluster.c +1 -1
index 908fd5f2c3c8..76295053ef9a 100644
@@ -107,7 +107,7 @@ xt_cluster_mt(const struct sk_buff *skb, struct xt_action_param *par)
 	}
 
 	ct = nf_ct_get(skb, &ctinfo);
-	if (ct == NULL)
+	if (ct == NULL || nf_ct_is_template(ct))
 		return false;
 
 	if (ct->master)
Signature · 1 line
2.47.3