netfilter: nft_last: incorrect arithmetics when restoring last used
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 5 Jul 2021 18:14:21 +0000 (20:14 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 6 Jul 2021 12:15:13 +0000 (14:15 +0200)
Subtract the jiffies that have passed by to current jiffies to fix last
used restoration.

Fixes: 836382dc2471 ("netfilter: nf_tables: add last expression")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nft_last.c

index bbb352b64c7378d5b83e5aba0354870419fcad94..8088b99f2ee3e4083bd3411c7aca3e09551f670f 100644 (file)
@@ -37,7 +37,7 @@ static int nft_last_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
                if (err < 0)
                        return err;
 
-               priv->last_jiffies = jiffies + (unsigned long)last_jiffies;
+               priv->last_jiffies = jiffies - (unsigned long)last_jiffies;
        }
 
        return 0;