From patchwork Thu Jan 10 03:32:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauricio Faria de Oliveira X-Patchwork-Id: 1022701 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Zs5c2ZHFz9sLw; Thu, 10 Jan 2019 14:33:08 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ghR5a-0002zg-7G; Thu, 10 Jan 2019 03:33:02 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1ghR5W-0002vG-Tp for kernel-team@lists.ubuntu.com; Thu, 10 Jan 2019 03:32:58 +0000 Received: from mail-qt1-f198.google.com ([209.85.160.198]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1ghR5V-0001sq-Q8 for kernel-team@lists.ubuntu.com; Thu, 10 Jan 2019 03:32:57 +0000 Received: by mail-qt1-f198.google.com with SMTP id z6so8812555qtj.21 for ; Wed, 09 Jan 2019 19:32:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=HNn1IZZFAmB3yUPpDWVq7xAJSJz453MegE6VLb50umg=; b=n3CvPZ0xEA+6O10fJ7vx/NEMGwO4P3mhNMzkE6lCPUxzYR+gWzoJOyP2MeIyUFMHR8 iLeetyfUZs1L7DqCMLDqF+6K8V5vkyN0wrb9K8kS8cewMErv5FM5aVYDE2sCW7cE0yEZ rcrpo8KhpiVSxmauFJARowGeikW96t3HMOAJQYwdygdBTP27p761ym/ubie5iIEj7xYz WeN60fFTbmecO3WiHWv1IW3H/O0KVwvkBNzj9RGIu2uMzVCsyEkbK81+1MHo4ySe6V/C z9sJf+/Z3h1suwfoo59DSE2IsbpGX9p+ya546jZXvwKTaDejX3uxXn9x5LBAKFQCuJSZ PhZQ== X-Gm-Message-State: AJcUukejwQWgkm+0UCDLmdrrawXxOsdxt7OxpfxqBx9WyH/yHiqvXGbi eiRe922DIZAXr6DvUCYLtCIEtL4ViJkZyDmwQMsNOQ6suq7kNfRKFclmCw67QbZHaYl/2FOXHIX /5W46wV+lno3QV7uwcjfLV/CcgA4505zeX1kCzKAxWQ== X-Received: by 2002:ac8:3879:: with SMTP id r54mr7827073qtb.69.1547091176839; Wed, 09 Jan 2019 19:32:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN77rY5MIC0aMlpQhrEh5EFcQZkWC5EmBxqL0E7d1YYMaBPFXN/qYX8qF91rVRWuvORqqvw+Vg== X-Received: by 2002:ac8:3879:: with SMTP id r54mr7827065qtb.69.1547091176675; Wed, 09 Jan 2019 19:32:56 -0800 (PST) Received: from localhost.localdomain ([177.181.227.0]) by smtp.gmail.com with ESMTPSA id 186sm15213337qke.10.2019.01.09.19.32.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jan 2019 19:32:56 -0800 (PST) From: Mauricio Faria de Oliveira To: kernel-team@lists.ubuntu.com Subject: [SRU X][PATCH 6/6] netfilter: nf_conncount: don't skip eviction when age is negative Date: Thu, 10 Jan 2019 01:32:04 -0200 Message-Id: <20190110033204.31413-7-mfo@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190110033204.31413-1-mfo@canonical.com> References: <20190110033204.31413-1-mfo@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Florian Westphal BugLink: https://bugs.launchpad.net/bugs/1811094 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 (backported from commit 4cd273bb91b3001f623f516ec726c49754571b1a) [mfo: backport: use older file name, nf_conncount.c -> xt_connlimit.c] Signed-off-by: Mauricio Faria de Oliveira --- 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 b64186de28e5..8106bd643aed 100644 --- a/net/netfilter/xt_connlimit.c +++ b/net/netfilter/xt_connlimit.c @@ -142,7 +142,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)