Message ID | 20201117122109.366986454@linuxfoundation.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4155355ils; Tue, 17 Nov 2020 05:11:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzHhEmh1OYOCKDQAVVwtUEChSTxKP75SyAUm6vmjl9QNfj4YEXykAmtopWfsw8vRtzXVOnt X-Received: by 2002:a05:6402:553:: with SMTP id i19mr20067659edx.194.1605618670802; Tue, 17 Nov 2020 05:11:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605618670; cv=none; d=google.com; s=arc-20160816; b=uXsTrTE2BR6PhEygFZeZEZNeXr0LHeAQyEhC3XE6zaryTXsbc3vESSysZ5MwLCjGr3 KLr1GK+S5mz6pdjO9Do6m8a/3XpoNhdMZMsKqaFdIlNQMBYokdMYY8I8oJmfVgq7hHUj Z67GbRY97iqqg2lsg/rkqx4xOGCF1MtoVTDsdr2z218rHqGXUIihSmwnCNajVuXmh/OC bs/2l3bgjq2DLNEkWD+hG3ihR7UPOiV2hcHA4MQflmykftCBUXT0oFKLtC9Pg8OrWYIp 6vuOrvw4aCoa/kSpWCiUmkCJL2phPe+aa33F3JDBoPJ5Mo6BmBFswvYDdgZZxrqn8RoE 5U5g== 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=qrOb86k/4f1dUJ8maDwVj8JjA4XH6kahJurJ/Fj5d0w=; b=OznIFicULKCvtUXP8IkuFTMVh+CK5joNSYdSH7yC6JBscfiU1XVMo+2EkgIBZZNSRJ 9fFOZf1JnZVcZKC0fLjWPfkJfxIcfiGZNNRP7dKL5hLfOxYsDl6ewbJHrrIev2yUu8sR 9NjkK3f4KPGAq+aJQBZPjqN94xxK5yFPp9MfTB0Hox14RlaTjiKQmY8MyQayjDNW4ZhO 1Spk6L4a++Ad1Oi/3VVWsDsbbpNIyAtqmJNc2b+3nIByLAnPJKEs6xenNkr0uTH6gVeA 513NNp2Du/3595WTp5V6VmYpwiF+LWSNiVjT5LvPQiKd1F1LK1SukU7FV+953YGdNN0o A7tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LviORb2F; 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 bu6si14358881edb.94.2020.11.17.05.11.10; Tue, 17 Nov 2020 05:11:10 -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=LviORb2F; 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 S1729507AbgKQNKk (ORCPT <rfc822;semen.protsenko@linaro.org> + 14 others); Tue, 17 Nov 2020 08:10:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:40038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729503AbgKQNKj (ORCPT <rfc822;stable@vger.kernel.org>); Tue, 17 Nov 2020 08:10:39 -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 0AACB2225B; Tue, 17 Nov 2020 13:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605618638; bh=2dQHQ4y/7d2lTuy439M7DmWm45Nj0t27ZhtaEcZzszQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LviORb2FZGYH22hK8irrlcKimqH04wLeuv2R8llDuhCGoYXi+wDcjjzAs9VY6Jb3O f/kdjDwJlUyiEv10PBrHq1M7yL/00RlgHYn2coPz2V58IdJ830F4gum/hgdKHWm3Ik Zxmikt8n5bs9a7n8fGCZJAmL59ESnRwrEkpGwT3g= 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.9 05/78] time: Prevent undefined behaviour in timespec64_to_ns() Date: Tue, 17 Nov 2020 14:04:31 +0100 Message-Id: <20201117122109.366986454@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122109.116890262@linuxfoundation.org> References: <20201117122109.116890262@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 980c71b3001a5..2a45b8c87edbf 100644 --- a/include/linux/time64.h +++ b/include/linux/time64.h @@ -188,6 +188,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; }