Message ID | 20201117122106.344550754@linuxfoundation.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4153029ils; Tue, 17 Nov 2020 05:08:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBb8XLqtKGchEZlkolhMRzMQJ/53awXmCX0o2GkJC026PEKuDKCc30KEk4H1FtW9QFFApr X-Received: by 2002:a50:8b65:: with SMTP id l92mr20846965edl.132.1605618502024; Tue, 17 Nov 2020 05:08:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605618502; cv=none; d=google.com; s=arc-20160816; b=NggtEpeLkG147nztgxPXFmRbApe3Upc3p+cFkAu7iTS61QXsQcS/cOZjFZcTtWhanG ggXPxZtRUv+/knbp+ooNlvNhksiTVcLW0JRJlNca2/DfXPqNVBC0eB/nULyM04VjviKK digaHKOB9FCVFwTV0UoB6CatlsA4H53jBTytDkTV65dl46zTv9DGOuY3p1+kiCC4q6T7 KU9LuL73MUwxBHtjnJ+QZSGfmKEot9oFm4wqwDT+XIVvnHkGZuju/G+FGAGrqrGKMMoF pmNqMmaTdJDXhpEeAh1zCJhrePOxyFnKQcuWlc673PLETu9WcCzWxgc583sQs1sgUXIE BawA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZDfjViKP3vJnL0vKhkh48T66vyQQrx21vQpt/mQBkIw=; b=L3xgIP/cvrR9vAM+K7DMRIafjphPseyQ6eBaUWneDuB5fhZNstz5UU75JNPgrdFjlh 0DuPN9V7cILZS2m7lfo1v4zoxZffPCCyJw4rlgK/2s3wKkZwUYMgo/hqauiAPvE0CmkB M5R/W9Hq+82+LoWhxHwaPL1K+668/r2QssbOjnH1l0T9AeE5Ev2a021LKkLcxlYfyl5S 0t9g73lWJjbzBLb8lvpqiC/nygoMMhh3xgfWxWpbcH4SmcwdiN0p/Y2Bkh7K5ZjA+sTc 2Fv8ZmfLCIfP2jmKIxE5m4Ww04m1Vppk/a3ejr5lAe5MTRtxB9SJl5eCp5ARFzW+53C3 zGqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=17GCvp9a; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: <stable-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r21si13835360edx.421.2020.11.17.05.08.21; Tue, 17 Nov 2020 05:08:22 -0800 (PST) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=17GCvp9a; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729039AbgKQNHJ (ORCPT <rfc822;semen.protsenko@linaro.org> + 14 others); Tue, 17 Nov 2020 08:07:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:33846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729034AbgKQNHG (ORCPT <rfc822;stable@vger.kernel.org>); Tue, 17 Nov 2020 08:07:06 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 89B3E2465E; Tue, 17 Nov 2020 13:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605618426; bh=+ik/dmEYMup5DcNgxfoB/2tUIfGLVh9dNRL1JaFZg3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=17GCvp9aSqail48snOjdLyXXKuX14ddOOMXtFCWGtJPXSaGL5RLjS4Ro8aWzoWgHv aLjAdglXvDXcJkLOkkmsm5YOIzqXH6yyFb3KJeSBSqPpJg1T+biMORuLrcR7ntA4vA f5W4grdzUtF+2IAaNpG1SGWb+W8bWrAj79sq2+wg= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Zeng Tao <prime.zeng@hisilicon.com>, Thomas Gleixner <tglx@linutronix.de>, Arnd Bergmann <arnd@arndb.de>, Sasha Levin <sashal@kernel.org> Subject: [PATCH 4.4 04/64] time: Prevent undefined behaviour in timespec64_to_ns() Date: Tue, 17 Nov 2020 14:04:27 +0100 Message-Id: <20201117122106.344550754@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122106.144800239@linuxfoundation.org> References: <20201117122106.144800239@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <stable.vger.kernel.org> X-Mailing-List: stable@vger.kernel.org |
Series |
None
|
expand
|
diff --git a/include/linux/time64.h b/include/linux/time64.h index 367d5af899e81..10239cffd70f8 100644 --- a/include/linux/time64.h +++ b/include/linux/time64.h @@ -197,6 +197,10 @@ static inline bool timespec64_valid_strict(const struct timespec64 *ts) */ static inline s64 timespec64_to_ns(const struct timespec64 *ts) { + /* Prevent multiplication overflow */ + if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX) + return KTIME_MAX; + return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; }