Hi Pablo, On Wed, Aug 07, 2024 at 04:23:50PM +0200, Pablo Neira Ayuso wrote: > Elements with less than HZ/10 milliseconds timeout never expire because > the element timeout extension is not allocated given that > nf_msecs_to_jiffies64() returns 0. Round up this timeout to HZ/10 to let > them time out. > > Fixes: 8e1102d5a159 ("netfilter: nf_tables: support timeouts larger than 23 days") > Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> > --- > net/netfilter/nf_tables_api.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c > index 481ee78e77bc..0fb8f8f1ef66 100644 > --- a/net/netfilter/nf_tables_api.c > +++ b/net/netfilter/nf_tables_api.c > @@ -4586,6 +4586,9 @@ int nf_msecs_to_jiffies64(const struct nlattr *nla, u64 *result) > if (ms >= max) > return -ERANGE; > > + if (ms < HZ/10) > + ms = HZ/10; > + This lower boundary works for HZ=100 only, right? With HZ=1000, the mininum timeout is calculated to 100ms, but the kernel ticks once per ms so 1ms is exactly 1 jiffie. > ms *= NSEC_PER_MSEC; > *result = nsecs_to_jiffies64(ms); Why not simply sanitize *result? E.g. like so: | *result = nsecs_to_jiffies64(ms) ?: !!ms; Cheers, Phil