Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3526440imu; Mon, 7 Jan 2019 05:06:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN7g8W0BCVKzDGSep2Yj6WB3alh0OJ7zg2NdrhACXXPlk8tOPW+xJvDdc5mQGoWQVs76KDqh X-Received: by 2002:a17:902:20b:: with SMTP id 11mr61354497plc.57.1546866403340; Mon, 07 Jan 2019 05:06:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546866403; cv=none; d=google.com; s=arc-20160816; b=N4bTymsUJbzs06uhjwEV3Qmuu05/pLMGAEeIraKNzxPorfOI26D/IJ86MKYGNDdNsE LlpgHCP5pd3rxxvESBnCP9mdyIufk4hcPhuwDloO5sedqI6/AwQT9SVtbn3h54REswDg p3+1ABUR/1Q+O0yMREuZHlX24wHtukey+BrcdKxQ5PSWIu2jb8eKcB7WAEUWVvJE/3NB nUJ+eRZLXnTf0x6VH7Zky/mHiGARfhFnCHCpuFqMWaAHYN+VupbVnDyHuyV8jmEcbDJT rscdluwELe2lw06M2ji3orLdmWyLExlgFwfqwiPI5lvuENOVI5vn2obmlwstthfxvJZD 5s7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VwXbj2MVSrFxm/wl/mCviRBFCaGqleSMLKewJ8YM4Rg=; b=KhMRGe9DYQZ2TMbB6QXzs8ZzMC2aM+w/lX99+glMiyjkFcx00laaLE2kYmqMaiocmy uPbm3yJmxbh1CUggJKwNigLlvpmsYOvYbHqtMtx4L2Ys3CIl+zxb+105FwjDjNKCrTtg XvXyv1n6BnjS9Td596ba1VZUbyCoV/MIdH69xVK6OCwPAY58ALMfBl1rYl7OIGAExv39 8Gz0+FA6vF3qlOTw00ZuMSfwsna1SPIuH4MvFFfzieuKZ+nPtaACHHn3Hn9kXE9dPL0A QqTYn0A63NiiFp+ylgIHKPMZ8JJ2m8QE/NVegGJMBnHZWpY7InPLLH/rneLeNplnQNAQ yaJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nMyd2+op; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i5si3040659pgn.243.2019.01.07.05.06.28; Mon, 07 Jan 2019 05:06:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nMyd2+op; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730775AbfAGNEf (ORCPT + 99 others); Mon, 7 Jan 2019 08:04:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:52166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731198AbfAGNEc (ORCPT ); Mon, 7 Jan 2019 08:04:32 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B831821736; Mon, 7 Jan 2019 13:04:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546866271; bh=ilF82cGwSKdFGuAppMt94XoZhOBEVrzPQPGsYBIJe2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nMyd2+op38aOO1Ub4I1b1VjQPUEXGJpliPhRk2e45Er9bqyUbd2mmaPNWAj+/qoNn A/5yPop948Pba2nmQJ96ecQTmegf8pCJN3pd5JqZMdFsx1qlD0FpuTwW9T8wiwdMlC RGupM9QH0HxQ+KCNGvbCI5lCMKXp6TSRPyjuljkU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shawn Bohrer , Florian Westphal , Pablo Neira Ayuso , Mauricio Faria de Oliveira , Sasha Levin Subject: [PATCH 4.14 084/101] netfilter: nf_conncount: dont skip eviction when age is negative Date: Mon, 7 Jan 2019 13:33:12 +0100 Message-Id: <20190107105337.538883836@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107105330.372621917@linuxfoundation.org> References: <20190107105330.372621917@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ 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 --- 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 913b86ef3a8d..b1646c24a632 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.19.1