diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-02-28 17:09:03 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-01-25 14:52:56 -0800 |
commit | 3be3c6123275cc269cc071c2ef9168f408aed25e (patch) | |
tree | 3d68b22d39bddf357684b6c8a3fd800794e87978 | |
parent | 42d46178488918b4001923cd44f460cc13d6059d (diff) |
netfilter: nft_last: copy content when cloning expression
commit 860e874290fb3be08e966c9c8ffc510c5b0f2bd8 upstream.
If the ruleset contains last timestamps, restore them accordingly.
Otherwise, listing after restoration shows never used items.
Fixes: 33a24de37e81 ("netfilter: nft_last: move stateful fields out of expression data")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/netfilter/nft_last.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/netfilter/nft_last.c b/net/netfilter/nft_last.c index 97d0d09d48d3..63145a5e69ef 100644 --- a/net/netfilter/nft_last.c +++ b/net/netfilter/nft_last.c @@ -104,11 +104,15 @@ static void nft_last_destroy(const struct nft_ctx *ctx, static int nft_last_clone(struct nft_expr *dst, const struct nft_expr *src) { struct nft_last_priv *priv_dst = nft_expr_priv(dst); + struct nft_last_priv *priv_src = nft_expr_priv(src); priv_dst->last = kzalloc(sizeof(*priv_dst->last), GFP_ATOMIC); if (!priv_dst->last) return -ENOMEM; + priv_dst->last->set = priv_src->last->set; + priv_dst->last->jiffies = priv_src->last->jiffies; + return 0; } |