Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2757368imj; Mon, 11 Feb 2019 08:02:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IbhpKi/XAh4zowKXlaVIxvrhPtjA3qQiwqAjqnkSmnabzeCcVr5Hcx3THHjtEnjvNDyjYLu X-Received: by 2002:a17:902:2867:: with SMTP id e94mr38673453plb.264.1549900971675; Mon, 11 Feb 2019 08:02:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900971; cv=none; d=google.com; s=arc-20160816; b=vS7G28LugybKw+1BqYF9defVLMZONbS+GAMs982UIZGn3n3aeSSwotJ1V1Tdr1TSVG jSWNG8d/s/XF4L/T+EsqdNaTvegi0LIqm5jKjgGYneVgwJ6R03PEORpoivWAMadprZVC x6Qizgy7+Lh8KKqaqB6+4Tj1bcxgSVU126biaqtZCOk4hc26uFU+wTeKURau2a64zxdt /1btEXhcrS+WdVcQM82yB/3VANJJ5fAd4lTOevw8//1b+BtdbSy74D/KC22Lb4IcWHH7 Lw0aHvvpOoLypHWz1s+pyEX7A/SiZPHiuaOEmHuSRxZZ/jjzkvG9zPRRlaA0MFkx4zFp g8Eg== 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=aQvKmcD4GUymn/w5COmbQZd30bg2LnJJ/keKdINwvfI=; b=emrsvFc5Y1rtBmp0jyU1qZSNWQjMv2TXVAmXCuZ6vM5ppXZwagxNvTxsAcQvX3Zl3k cMehXern1gO2EYR4CMM123Fjw9sfcCOUTDET+DVqk1TDVvwgbi3RV6lq7uYj+stD+Ykg x36XNWElH8NRHtBejUuoiZdadGC4wWRBDeDg6aDtvn4R3yl4dSxLjXe2phVS4BzjOl6m S4vQvxlSKLWZGQ33A4LNtP55jjms5U2MC7SGoXGYeCjz3n9TJDuLSsAi0BliM4HoBuYJ hwh1wDcPMzjXjGC4ytNw0GOnfwMm8HRm4E3IAoIkVT+OuQ6OoTREWXGd/Gn+9n+lQONE 5AWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nm78Yzzv; 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 f18si9616743pgl.457.2019.02.11.08.02.31; Mon, 11 Feb 2019 08:02:51 -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=nm78Yzzv; 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 S1730661AbfBKQAB (ORCPT + 99 others); Mon, 11 Feb 2019 11:00:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:39028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728697AbfBKObw (ORCPT ); Mon, 11 Feb 2019 09:31:52 -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 D9FF320675; Mon, 11 Feb 2019 14:31:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895512; bh=4MV2u4NNN1LlRQur2lIMlsUL7hu5xBSm89axsLO9CSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nm78Yzzv9UGTjmoyLQTLVAIXwfV3lU/LjGVmng8Rpz7Hs8SmQQWhLBJ7Wb8WKXyY9 jphTZGebnl7EQLGevEZClea+bIwI/nCSb0hOYp7qxIO6vM8DSup7bkM5eGgpWYl38q 4QC+Ool0kN7NCCdDdaINhSzEcG8TXVyrc0obMfKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YueHaibing , Steffen Klassert , Sasha Levin Subject: [PATCH 4.20 212/352] xfrm6_tunnel: Fix spi check in __xfrm6_tunnel_alloc_spi Date: Mon, 11 Feb 2019 15:17:19 +0100 Message-Id: <20190211141900.678392014@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@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.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit fa89a4593b927b3f59c3b69379f31d3b22272e4e ] gcc warn this: net/ipv6/xfrm6_tunnel.c:143 __xfrm6_tunnel_alloc_spi() warn: always true condition '(spi <= 4294967295) => (0-u32max <= u32max)' 'spi' is u32, which always not greater than XFRM6_TUNNEL_SPI_MAX because of wrap around. So the second forloop will never reach. Signed-off-by: YueHaibing Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/ipv6/xfrm6_tunnel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index 4a46df8441c9..f5b4febeaa25 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c @@ -144,6 +144,9 @@ static u32 __xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr) index = __xfrm6_tunnel_spi_check(net, spi); if (index >= 0) goto alloc_spi; + + if (spi == XFRM6_TUNNEL_SPI_MAX) + break; } for (spi = XFRM6_TUNNEL_SPI_MIN; spi < xfrm6_tn->spi; spi++) { index = __xfrm6_tunnel_spi_check(net, spi); -- 2.19.1