]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
netfilter: nfnetlink_cthelper: cap to maximum number of expectation per master
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 26 Jun 2026 11:40:42 +0000 (13:40 +0200)
committerFlorian Westphal <fw@strlen.de>
Tue, 30 Jun 2026 04:37:12 +0000 (06:37 +0200)
If userspace helper policy updates sets maximum number of expectation to
zero, cap it to NF_CT_EXPECT_MAX_CNT (255) on updates too.

Fixes: 397c8300972f ("netfilter: nf_conntrack_helper: cap maximum number of expectation at helper registration")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
net/netfilter/nfnetlink_cthelper.c

index f1460b683d7af7e8f43336c46b99a5efe441fe11..2cbcca9110dbf50448d6bb205e1fc224521f853c 100644 (file)
@@ -163,6 +163,8 @@ nfnl_cthelper_expect_policy(struct nf_conntrack_expect_policy *expect_policy,
                    tb[NFCTH_POLICY_NAME], NF_CT_HELPER_NAME_LEN);
        expect_policy->max_expected =
                ntohl(nla_get_be32(tb[NFCTH_POLICY_EXPECT_MAX]));
+       if (!expect_policy->max_expected)
+               expect_policy->max_expected = NF_CT_EXPECT_MAX_CNT;
        if (expect_policy->max_expected > NF_CT_EXPECT_MAX_CNT)
                return -EINVAL;