netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauricio Faria de Oliveira <mfo@canonical.com>
To: stable@vger.kernel.org, netdev@vger.kernel.org,
	Florian Westphal <fw@strlen.de>
Cc: Alakesh Haloi <alakeshh@amazon.com>,
	nivedita.singhvi@canonical.com,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
	"David S. Miller" <davem@davemloft.net>,
	Yi-Hung Wei <yihung.wei@gmail.com>
Subject: [PATCH v2 4.14 5/5] netfilter: nf_conncount: don't skip eviction when age is negative
Date: Wed,  2 Jan 2019 18:42:04 -0200	[thread overview]
Message-ID: <20190102204204.12389-6-mfo@canonical.com> (raw)
In-Reply-To: <20190102204204.12389-1-mfo@canonical.com>

From: Florian Westphal <fw@strlen.de>

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 <sbohrer@cloudflare.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

[mfo: backport: use older file name, nf_conncount.c -> xt_connlimit.c]
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
---
 net/netfilter/xt_connlimit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c
index 913b86ef..b1646c2 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)
-- 
2.7.4

  parent reply	other threads:[~2019-01-02 20:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-02 20:41 [PATCH v2 4.14 0/5] netfilter: xt_connlimit: backport upstream fixes for race in connection counting Mauricio Faria de Oliveira
2019-01-02 20:42 ` [PATCH v2 4.14 1/5] netfilter: xt_connlimit: don't store address in the conn nodes Mauricio Faria de Oliveira
2019-01-02 20:42 ` [PATCH v2 4.14 2/5] netfilter: nf_conncount: expose connection list interface Mauricio Faria de Oliveira
2019-01-02 20:42 ` [PATCH v2 4.14 3/5] netfilter: nf_conncount: Fix garbage collection with zones Mauricio Faria de Oliveira
2019-01-02 20:42 ` [PATCH v2 4.14 4/5] netfilter: nf_conncount: fix garbage collection confirm race Mauricio Faria de Oliveira
2019-01-02 20:42 ` Mauricio Faria de Oliveira [this message]
2019-01-06 17:56 ` [PATCH v2 4.14 0/5] netfilter: xt_connlimit: backport upstream fixes for race in connection counting Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190102204204.12389-6-mfo@canonical.com \
    --to=mfo@canonical.com \
    --cc=alakeshh@amazon.com \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=netdev@vger.kernel.org \
    --cc=nivedita.singhvi@canonical.com \
    --cc=pablo@netfilter.org \
    --cc=stable@vger.kernel.org \
    --cc=yihung.wei@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).