Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795620739; b=3rpC/UIOMp1C0E3szpM6m5kTZXHNg9j+HrJTer1wl6UJqylywpnQcxq7yNWrrBdOfemk q0r4uMWM6YzPQlIPeygbOXzW258GSrE5aeWGZj4IzL5PTWqRhoMXjyfvX3Rt6IagmvXRA j8Si3kHR3pROAIao39d0wh8BN1PD6dLYk6CZDQU8ko/Yn3OdVo7hFwR5WqdQ4D3f2IUOZ xmXXQkefUfSrnylsCgmpTqjeV8TBhFD6aGB/p7z8yakDHaNDY9VPozgZVig0FDZsFC4Br YYEJBAtv7obY1+KY2+oKGlWxZwXK4QZZhI5yb0UEKf2zrFqDIN264/Rq1LZHjCqa3YQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795620739; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=FiZZOp3UwlPdnY8AvaAswEZfeqQSZWpKqlslF0sOfhQ=; b=DtpstIsIB/Uso1y1ICaWCE9opTBll+J6RXcV8fu/Eon0rge5tXb3FdxwOeKcTG1oAQeC U3uIEpu1k03UDGsWzPpKsz7hlset7ct0AaCRa7tgQzRu2wIC0ziLuBxLDqRx0R9oKo26d 1y6TnZCHHbyNbPYlADTFAS5Ykz6G2EDZFRN1bCaNHHSlFP8sRC9oETcl/Ep1S/Ysw0jyQ arIqHI9kKd8O5WZJOIJzDhP1ZmI60CgOa93dSgkCiYp4WgEMsVEYJj7FYr6cQgE8cXQgX sbzLlX/mUJYJnnOq+ZnCHnSJ3/DWkwVRBeg8imGb/2t8vAIKO65LAVGpIYY0IOgTdiQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Jp3a3i+3; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98193606A321; Wed, 25 Nov 2026 15:32:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Jp3a3i+3 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E70CB1F000D3; Wed, 25 Nov 2026 15:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795620739; bh=FiZZOp3UwlPdnY8AvaAswEZfeqQSZWpKqlslF0sOfhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Jp3a3i+3OLYoVsEWSIdtASnMKrLsraHS2OrlsRlCLvWKwmEe5xJr1zLLt2Wda7Yqt 0Tg0pftZyRcNnqyWPSShSLomdW2Vnac+KSZfcRXQ4fAyvH0faySR7n07x/HAlUUQMb 99905h/4WWK1ZbmPZjaaFzbPOBy4xDaP1nUx/6UM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Florian Westphal , Pablo Neira Ayuso , Mark Bundschuh , Sasha Levin Subject: [PATCH 6.12 001/816] netfilter: nft_ct: expectation timeouts are passed in milliseconds Date: Wed, 25 Nov 2026 15:25:49 +0100 Message-ID: <20261125143849.247683650@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261125143849.205329330@linuxfoundation.org> References: <20261125143849.205329330@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal [ Upstream commit 6fb421bd07f156cdf0cdede062d31f1c21def326 ] Userspace passes '5000' in case user asks for 5 seconds. Allowing for sub-second expectation lifetimes makes sense to me. so fix up the kernel side instead of munging nft to send a value rounded up to next second. Also note that this violates nft convention of passing integers in network byte order, but we can't change this anymore. Fixes: 857b46027d6f ("netfilter: nft_ct: add ct expectations support") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Stable-dep-of: 3679da4ad8be ("netfilter: nft_ct: move custom expectation support to helper") Signed-off-by: Mark Bundschuh Signed-off-by: Sasha Levin --- net/netfilter/nft_ct.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c index 07a879f66fabe..206cfa2734c68 100644 --- a/net/netfilter/nft_ct.c +++ b/net/netfilter/nft_ct.c @@ -1198,11 +1198,23 @@ struct nft_ct_expect_obj { u32 timeout; }; +static int nft_ct_expect_timeout_get(const struct nlattr *attr, u32 *val) +{ + unsigned long jiffies_val = msecs_to_jiffies(nla_get_u32(attr)); + + if (jiffies_val > UINT_MAX) + return -ERANGE; + + *val = jiffies_val; + return 0; +} + static int nft_ct_expect_obj_init(const struct nft_ctx *ctx, const struct nlattr * const tb[], struct nft_object *obj) { struct nft_ct_expect_obj *priv = nft_obj_data(obj); + int err; if (!tb[NFTA_CT_EXPECT_L4PROTO] || !tb[NFTA_CT_EXPECT_DPORT] || @@ -1238,8 +1250,11 @@ static int nft_ct_expect_obj_init(const struct nft_ctx *ctx, return -EOPNOTSUPP; } + err = nft_ct_expect_timeout_get(tb[NFTA_CT_EXPECT_TIMEOUT], &priv->timeout); + if (err) + return err; + priv->dport = nla_get_be16(tb[NFTA_CT_EXPECT_DPORT]); - priv->timeout = nla_get_u32(tb[NFTA_CT_EXPECT_TIMEOUT]); priv->size = nla_get_u8(tb[NFTA_CT_EXPECT_SIZE]); return nf_ct_netns_get(ctx->net, ctx->family); @@ -1259,7 +1274,7 @@ static int nft_ct_expect_obj_dump(struct sk_buff *skb, if (nla_put_be16(skb, NFTA_CT_EXPECT_L3PROTO, htons(priv->l3num)) || nla_put_u8(skb, NFTA_CT_EXPECT_L4PROTO, priv->l4proto) || nla_put_be16(skb, NFTA_CT_EXPECT_DPORT, priv->dport) || - nla_put_u32(skb, NFTA_CT_EXPECT_TIMEOUT, priv->timeout) || + nla_put_u32(skb, NFTA_CT_EXPECT_TIMEOUT, jiffies_to_msecs(priv->timeout)) || nla_put_u8(skb, NFTA_CT_EXPECT_SIZE, priv->size)) return -1; @@ -1309,7 +1324,7 @@ static void nft_ct_expect_obj_eval(struct nft_object *obj, &ct->tuplehash[!dir].tuple.src.u3, &ct->tuplehash[!dir].tuple.dst.u3, priv->l4proto, NULL, &priv->dport); - exp->timeout += priv->timeout * HZ; + exp->timeout += priv->timeout; if (nf_ct_expect_related(exp, 0) != 0) regs->verdict.code = NF_DROP; -- 2.53.0