mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-11 17:10:13 +00:00
netfilter: nf_conncount: update last_gc only when GC has been performed
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: d265929930e2 ("netfilter: nf_conncount: reduce unnecessary GC")
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
This commit is contained in:
parent
d077e8119d
commit
7811ba4524
@ -229,6 +229,7 @@ static int __nf_conncount_add(struct net *net,
|
|||||||
|
|
||||||
nf_ct_put(found_ct);
|
nf_ct_put(found_ct);
|
||||||
}
|
}
|
||||||
|
list->last_gc = (u32)jiffies;
|
||||||
|
|
||||||
add_new_node:
|
add_new_node:
|
||||||
if (WARN_ON_ONCE(list->count > INT_MAX)) {
|
if (WARN_ON_ONCE(list->count > INT_MAX)) {
|
||||||
@ -248,7 +249,6 @@ add_new_node:
|
|||||||
conn->jiffies32 = (u32)jiffies;
|
conn->jiffies32 = (u32)jiffies;
|
||||||
list_add_tail(&conn->node, &list->head);
|
list_add_tail(&conn->node, &list->head);
|
||||||
list->count++;
|
list->count++;
|
||||||
list->last_gc = (u32)jiffies;
|
|
||||||
|
|
||||||
out_put:
|
out_put:
|
||||||
if (refcounted)
|
if (refcounted)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user