Skip to content

Commit

Permalink
netfilter: nft_last: incorrect arithmetics when restoring last used
Browse files Browse the repository at this point in the history
Subtract the jiffies that have passed by to current jiffies to fix last
used restoration.

Fixes: 836382d ("netfilter: nf_tables: add last expression")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Pablo Neira Ayuso committed Jul 6, 2021
1 parent 6ac4bac commit d1b5b80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netfilter/nft_last.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d1b5b80

Please sign in to comment.