]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
netfilter: nf_conncount: don't skip eviction when age is negative
authorFlorian Westphal <fw@strlen.de>
Fri, 28 Dec 2018 00:24:43 +0000 (01:24 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 29 Dec 2018 01:45:18 +0000 (02:45 +0100)
age is signed integer, so result can be negative when the timestamps
have a large delta.  In this case we want to discard the entry.

Instead of using age >= 2 || age < 0, just make it unsigned.

Fixes: b36e4523d4d56 ("netfilter: nf_conncount: fix garbage collection confirm race")
Reviewed-by: Shawn Bohrer <sbohrer@cloudflare.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conncount.c

index 3271a4e005007c4cf03bbd9ff3c4b5f7bbfb669b..8bb4ed85c26204b857e3420401468e994f502457 100644 (file)
@@ -155,7 +155,7 @@ find_or_evict(struct net *net, struct nf_conncount_list *list,
        const struct nf_conntrack_tuple_hash *found;
        unsigned long a, b;
        int cpu = raw_smp_processor_id();
-       __s32 age;
+       u32 age;
 
        found = nf_conntrack_find_get(net, &conn->zone, &conn->tuple);
        if (found)