Skip to content

Commit 57ab63c

Browse files
author
CKI Backport Bot
committed
netfilter: nf_conncount: garbage collection is not skipped when jiffies wrap around
JIRA: https://issues.redhat.com/browse/RHEL-84544 commit df08c94 Author: Nicklas Bo Jensen <njensen@akamai.com> Date: Thu Feb 27 13:32:34 2025 +0000 netfilter: nf_conncount: garbage collection is not skipped when jiffies wrap around nf_conncount is supposed to skip garbage collection if it has already run garbage collection in the same jiffy. Unfortunately, this is broken when jiffies wrap around which this patch fixes. The problem is that last_gc in the nf_conncount_list struct is an u32, but jiffies is an unsigned long which is 8 bytes on my systems. When those two are compared it only works until last_gc wraps around. See bug report: https://bugzilla.netfilter.org/show_bug.cgi?id=1778 for more details. Fixes: d265929 ("netfilter: nf_conncount: reduce unnecessary GC") Signed-off-by: Nicklas Bo Jensen <njensen@akamai.com> Reviewed-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com>
1 parent 66315c0 commit 57ab63c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/netfilter/nf_conncount.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static int __nf_conncount_add(struct net *net,
132132
struct nf_conn *found_ct;
133133
unsigned int collect = 0;
134134

135-
if (time_is_after_eq_jiffies((unsigned long)list->last_gc))
135+
if ((u32)jiffies == list->last_gc)
136136
goto add_new_node;
137137

138138
/* check the saved connections */
@@ -234,7 +234,7 @@ bool nf_conncount_gc_list(struct net *net,
234234
bool ret = false;
235235

236236
/* don't bother if we just did GC */
237-
if (time_is_after_eq_jiffies((unsigned long)READ_ONCE(list->last_gc)))
237+
if ((u32)jiffies == READ_ONCE(list->last_gc))
238238
return false;
239239

240240
/* don't bother if other cpu is already doing GC */

0 commit comments

Comments
 (0)