From patchwork Thu Jan 10 03:36:03 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: 1022712 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 43ZsBB4Zyjz9sLw; Thu, 10 Jan 2019 14:37:06 +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 1ghR9Q-00041m-Pj; Thu, 10 Jan 2019 03:37:00 +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 1ghR9M-0003xX-BE for kernel-team@lists.ubuntu.com; Thu, 10 Jan 2019 03:36:56 +0000 Received: from mail-qk1-f197.google.com ([209.85.222.197]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1ghR9L-0002B0-W8 for kernel-team@lists.ubuntu.com; Thu, 10 Jan 2019 03:36:56 +0000 Received: by mail-qk1-f197.google.com with SMTP id j125so8099420qke.12 for ; Wed, 09 Jan 2019 19:36:55 -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=z3+wMkKRyQHrT63vbLQAjk6bo3H51esD34hHBklAfXI=; b=W2CWETOHJt1s5FN5HaoV5BeFJ3p/3AiaTPUEGX9h3mMpoC4sB4eYQiJpQI+DMM2kRQ 5AEUO5ofwYrrIbUpIbGT5LJYQo6a+QR2ovXl08eQklqf6MXP/Bt0acQshcsLj2n+bEFV kdcZEq97fgS6bdlnXgg2YZxOKDyZzlqUF8fe/hvPSQJnRnVmo0mHRuszRe2v4kDrFRjU mQcxD2xeeONtLxZCosfdKlkXTSk7XHAkhQHZWXtK9wuy3Q1dOJSkCczFsSErdZIc6imf gAInftvbknbiMsgcgfcwf1TJlhOoKJvzqio8Vj7fCl4SrBHJXfCM50M9sDo3jMhPpeE4 bGHw== X-Gm-Message-State: AJcUukdJChla8wcAXWzjN2K2F8T1ZGiqm3CMi7c80hbCxsfWWR3o4+17 MYGnKCqFQf2DDwbwCtvvTje/aY1hFyZVenWiFRaUnYkboABbFJIZGv+wK4VoVnTKgImlt0iuy9/ TJLk8KcAPNxESca+wgsOYw9CFkvsqBcyz7D8oL5QqSg== X-Received: by 2002:ac8:4611:: with SMTP id p17mr8368465qtn.263.1547091415067; Wed, 09 Jan 2019 19:36:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN4kmUj035ugalrS9kmafQtPj63dHFQTncGo8R/cv6Qp2R/1rH7RQVzazGTrAn5O98SszUMNTA== X-Received: by 2002:ac8:4611:: with SMTP id p17mr8368458qtn.263.1547091414931; Wed, 09 Jan 2019 19:36:54 -0800 (PST) Received: from localhost.localdomain ([177.181.227.0]) by smtp.gmail.com with ESMTPSA id y4sm43568428qtc.47.2019.01.09.19.36.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jan 2019 19:36:54 -0800 (PST) From: Mauricio Faria de Oliveira To: kernel-team@lists.ubuntu.com Subject: [SRU B][PATCH 5/5] netfilter: nf_conncount: don't skip eviction when age is negative Date: Thu, 10 Jan 2019 01:36:03 -0200 Message-Id: <20190110033603.31647-6-mfo@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190110033603.31647-1-mfo@canonical.com> References: <20190110033603.31647-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 3ae81808d93c..96185e3c5e56 100644 --- a/net/netfilter/xt_connlimit.c +++ b/net/netfilter/xt_connlimit.c @@ -123,7 +123,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)