From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AB2E15AE7 for ; Wed, 20 Sep 2023 12:17:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1B4AC433CA; Wed, 20 Sep 2023 12:17:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1695212266; bh=WGAOGvdBT7egE/L6hnA0Y+A1kDM/UpYojw4Ope5mXuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dofm6TOcoYLKayA56SWxNuN4A0nvHGr/utFR9bahqwSlzmLcC41jtaZVhHea/JCJf 0VHLEIssyUuvA1ZIYlGCneH/4p3KAKcCz4txtoLd/jnV6Jasmn7hSA7HdOHvrjlthR 9C0oBe6y81xXaPD8KYMHdcA6vp/MOKKjgRZI5ZE8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alex Henrie , David Ahern , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 213/273] net: ipv6/addrconf: avoid integer underflow in ipv6_create_tempaddr Date: Wed, 20 Sep 2023 13:30:53 +0200 Message-ID: <20230920112853.043454947@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230920112846.440597133@linuxfoundation.org> References: <20230920112846.440597133@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alex Henrie [ Upstream commit f31867d0d9d82af757c1e0178b659438f4c1ea3c ] The existing code incorrectly casted a negative value (the result of a subtraction) to an unsigned value without checking. For example, if /proc/sys/net/ipv6/conf/*/temp_prefered_lft was set to 1, the preferred lifetime would jump to 4 billion seconds. On my machine and network the shortest lifetime that avoided underflow was 3 seconds. Fixes: 76506a986dc3 ("IPv6: fix DESYNC_FACTOR") Signed-off-by: Alex Henrie Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv6/addrconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 5c5c5736f6892..5ffa8777ab098 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -1321,7 +1321,7 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, * idev->desync_factor if it's larger */ cnf_temp_preferred_lft = READ_ONCE(idev->cnf.temp_prefered_lft); - max_desync_factor = min_t(__u32, + max_desync_factor = min_t(long, idev->cnf.max_desync_factor, cnf_temp_preferred_lft - regen_advance); -- 2.40.1