Skip to content

Commit 8bdafdf

Browse files
ffmanceragregkh
authored andcommitted
netfilter: nf_conncount: update last_gc only when GC has been performed
[ Upstream commit 7811ba4 ] Currently last_gc is being updated everytime a new connection is tracked, that means that it is updated even if a GC wasn't performed. With a sufficiently high packet rate, it is possible to always bypass the GC, causing the list to grow infinitely. Update the last_gc value only when a GC has been actually performed. Fixes: d265929 ("netfilter: nf_conncount: reduce unnecessary GC") Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 7f066cb commit 8bdafdf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/netfilter/nf_conncount.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ static int __nf_conncount_add(struct net *net,
229229

230230
nf_ct_put(found_ct);
231231
}
232+
list->last_gc = (u32)jiffies;
232233

233234
add_new_node:
234235
if (WARN_ON_ONCE(list->count > INT_MAX)) {
@@ -248,7 +249,6 @@ static int __nf_conncount_add(struct net *net,
248249
conn->jiffies32 = (u32)jiffies;
249250
list_add_tail(&conn->node, &list->head);
250251
list->count++;
251-
list->last_gc = (u32)jiffies;
252252

253253
out_put:
254254
if (refcounted)

0 commit comments

Comments
 (0)