From: Florian Westphal Date: Wed, 2 Jan 2019 20:42:04 +0000 (-0200) Subject: netfilter: nf_conncount: don't skip eviction when age is negative X-Git-Tag: v4.14.92~19 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=052ccb86b31c184d8ed7d76d1c06d7ca0b8fd32e;p=users%2Fjedix%2Flinux-maple.git netfilter: nf_conncount: don't skip eviction when age is negative commit 4cd273bb91b3001f623f516ec726c49754571b1a upstream. (not in Linus's tree now, but in nf.git + linux-next.git already.) 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 Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso [mfo: backport: use older file name, nf_conncount.c -> xt_connlimit.c] Signed-off-by: Mauricio Faria de Oliveira Signed-off-by: Sasha Levin --- diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c index 913b86ef3a8d7..b1646c24a6326 100644 --- a/net/netfilter/xt_connlimit.c +++ b/net/netfilter/xt_connlimit.c @@ -141,7 +141,7 @@ find_or_evict(struct net *net, struct xt_connlimit_conn *conn) 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)