Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2959476imu; Mon, 19 Nov 2018 08:38:33 -0800 (PST) X-Google-Smtp-Source: AJdET5cgJDxbRun56yqCzAV4VA4+4xrEk82gRpryC+eP8z/m2gv6i3zwK9rpa08kJ4e0w9CNHXom X-Received: by 2002:a63:f547:: with SMTP id e7mr21081412pgk.182.1542645513232; Mon, 19 Nov 2018 08:38:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542645513; cv=none; d=google.com; s=arc-20160816; b=G3zvbe/4QFsSrbTplTjwxOCXn2vnUGrgAgPmfIcXNeulijAzh5jvBYG5ga/IPZNzKg gRNTPf7Qq48qnr9Dsw3Asol4LfsbhSH7/2ufDjA9lIf0tADhiA44g2r8UcrcuOCcbxMT VqH4yMTJ0vd01LII7iJEH6V4zMeD/mlQJtaoxI9FLasMdVY8hgkWabrnHnch0wBwVOku 58viCHciUXTog7rDluTSVLIoVE9/pKtwZhqNzMSTtfYm9iBis0YpN8YEW4nZTVSkFair 2SJkkcyNaQg548/yxNIKX9Rx96H9c9b/4EJh6hhe+c2MYwa+LkvJnHMF5BVRBlKTeL62 /8VQ== 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=DwwomjPESf+fAZ3MH2xy1Ll18jV/NM0aOWgqgreWcKI=; b=maWoM9JnVlUKQK5dlGR+BrDgMdQLQaF1cVa9Vtort4GIphSOz4N/k1W31CkJnRVpH9 tunc7ND8FVRnBqEjGQ4o6eJu9rsCER39kfAqSF/HjVcLfUYFahM7sSAq34dJb1zcMiWc DACykGSbXH3saGh5zNa6zsSuyINjyNuTxgjb/q/ou7pN08RJUdy7mPRlJHhUFAUR06IF ZWMFoENKv3YgVc6DlZOkXPjqbqN7CHoLjrkiHwtuvIQckrqRWKgF6pQ2Xoik/N8+W49I epJyuPaOHbSTI3IF/5H92mKQZ8D3IokCeYuyFPgbiI7yk1bJ9X4bGOGGvMgaxb1Y4fLH 3fDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rNBqt0d0; 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 c16si9298324plo.270.2018.11.19.08.38.18; Mon, 19 Nov 2018 08:38:33 -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=rNBqt0d0; 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 S1732106AbeKTDBO (ORCPT + 99 others); Mon, 19 Nov 2018 22:01:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:33044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730931AbeKTDBN (ORCPT ); Mon, 19 Nov 2018 22:01:13 -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 97EA2206BA; Mon, 19 Nov 2018 16:37:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645425; bh=5Et0NZrxhKtU+uzjrEANMp2PDxEGrvZsZKlZ7Woxh2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rNBqt0d0kPOu25mCrHYtPgrZeDcRi4JieQyTbtxl2dVeAyJp9Np4OvLb7/0Qmv0nX DpqcHxrSjjU+NnVZ0xSpgPAQ87YeiIvgkkr2ezwOYSWM6OQ9cjrEz7rwXlii5LQ+Tf 1eYcIXeHduD3aAnTiASZWRdaQUjUTOuKe1BNEo/k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Alexandre Belloni Subject: [PATCH 4.19 158/205] rtc: hctosys: Add missing range error reporting Date: Mon, 19 Nov 2018 17:27:45 +0100 Message-Id: <20181119162639.323027859@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maciej W. Rozycki commit 7ce9a992ffde8ce93d5ae5767362a5c7389ae895 upstream. Fix an issue with the 32-bit range error path in `rtc_hctosys' where no error code is set and consequently the successful preceding call result from `rtc_read_time' is propagated to `rtc_hctosys_ret'. This in turn makes any subsequent call to `hctosys_show' incorrectly report in sysfs that the system time has been set from this RTC while it has not. Set the error to ERANGE then if we can't express the result due to an overflow. Signed-off-by: Maciej W. Rozycki Fixes: b3a5ac42ab18 ("rtc: hctosys: Ensure system time doesn't overflow time_t") Cc: stable@vger.kernel.org # 4.17+ Signed-off-by: Alexandre Belloni Signed-off-by: Greg Kroah-Hartman --- drivers/rtc/hctosys.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/rtc/hctosys.c +++ b/drivers/rtc/hctosys.c @@ -50,8 +50,10 @@ static int __init rtc_hctosys(void) tv64.tv_sec = rtc_tm_to_time64(&tm); #if BITS_PER_LONG == 32 - if (tv64.tv_sec > INT_MAX) + if (tv64.tv_sec > INT_MAX) { + err = -ERANGE; goto err_read; + } #endif err = do_settimeofday64(&tv64);