From patchwork Thu Jan 10 03:45:39 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: 1022713 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 43ZsP50Vrhz9sN8; Thu, 10 Jan 2019 14:46:33 +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 1ghRIZ-00069B-29; Thu, 10 Jan 2019 03:46:27 +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 1ghRIX-00068s-K8 for kernel-team@lists.ubuntu.com; Thu, 10 Jan 2019 03:46:25 +0000 Received: from mail-qt1-f200.google.com ([209.85.160.200]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1ghRIX-0002mJ-Aw for kernel-team@lists.ubuntu.com; Thu, 10 Jan 2019 03:46:25 +0000 Received: by mail-qt1-f200.google.com with SMTP id z6so8836347qtj.21 for ; Wed, 09 Jan 2019 19:46:25 -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=Tt+lY4PuJH4GWXivJ2xjZCGcrOCQpCL9TIvj6304CbA=; b=Qi6TZyAlETJor1AQWwb5L4cVuH4imcI4FjBcbMRm6bbgE/EZUI5kAGAdGhVoeWIkWh irNtTtCWGutNZmoln+vEBFXBQo7r5JUqrJonkuJflOvncPY6X8F/a9uAcMYd8TET42rc onDEjddExU/mRMUP4uheKzlZApYTaXyJZ2B+6ix5blSJ8Xcp0XKnNDew8RHCBjbJsbVz bR26+UzJayXC6EQaGJUQJRmSVLfOX/GJof099r04k4JifhXYqmi1vHCw2TGbVNJCYK8w 22x+Cwrlbqa9yDr36t+3DwudTjcySW979Fow+bqb+xfhV4BahTeewB884PbI7GzM56uq RhTg== X-Gm-Message-State: AJcUukdp9LtZeFZAfJ5siB3ARlRiPIeaeKQZxftYO/66VMpUxSGyT808 dT2/ZhGXe2X9wL86gdWJjKGEAfDEDRxaaMTGyNt7bP/788maMaUIFikSeEK5wN1cKhEgn5RHyiO 2kuL7GlQi0SGygLwudVgioTorxgTF8Aw2HH/B3ywC0Q== X-Received: by 2002:aed:2702:: with SMTP id n2mr7991755qtd.216.1547091984308; Wed, 09 Jan 2019 19:46:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN6CftmUVJCWtuC5z29Wu2gBikcNxxk4QyRGkHSYLEzM6PjFkw99124bmB+AhhNiltGU9k0rjQ== X-Received: by 2002:aed:2702:: with SMTP id n2mr7991752qtd.216.1547091984167; Wed, 09 Jan 2019 19:46:24 -0800 (PST) Received: from localhost.localdomain ([177.181.227.0]) by smtp.gmail.com with ESMTPSA id e17sm40968966qte.12.2019.01.09.19.46.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jan 2019 19:46:23 -0800 (PST) From: Mauricio Faria de Oliveira To: kernel-team@lists.ubuntu.com Subject: [SRU C, D/Unstable][PATCH 1/1] netfilter: nf_conncount: don't skip eviction when age is negative Date: Thu, 10 Jan 2019 01:45:39 -0200 Message-Id: <20190110034539.32046-2-mfo@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190110034539.32046-1-mfo@canonical.com> References: <20190110034539.32046-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 (cherry picked from commit 4cd273bb91b3001f623f516ec726c49754571b1a) Signed-off-by: Mauricio Faria de Oliveira Acked-by: Stefan Bader Acked-by: Kleber Sacilotto de Souza --- net/netfilter/nf_conncount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c index 510039862aa9..79d1e17a39d8 100644 --- a/net/netfilter/nf_conncount.c +++ b/net/netfilter/nf_conncount.c @@ -106,7 +106,7 @@ find_or_evict(struct net *net, struct nf_conncount_tuple *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)