lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Wed, 17 Jan 2018 23:30:47 +0800
From:   SZ Lin (林上智) 
        <sz.lin@...a.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     SZ Lin (林上智) 
        <sz.lin@...a.com>, Taiyi Wu <taiyity.wu@...a.com>,
        Alessandro Zummo <a.zummo@...ertech.it>,
        Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
        linux-rtc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] rtc: tps65910: add bounds checking

Since tm->tm_year is the offset relative to 1900, it needs to check for
positive value to avoid overflow in YEARS_REG register.

The system will hang at the following stage on the next boot when overflow
has occurred.

[    2.221192] systemd[1]: Time has been changed

This patch fixes the above hanging issue by adding bounds checking.

Signed-off-by: Taiyi Wu <taiyity.wu@...a.com>
Signed-off-by: SZ Lin (林上智) <sz.lin@...a.com>
---
 drivers/rtc/rtc-tps65910.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c
index d0244d7979fc..6be9f7bb0f1b 100644
--- a/drivers/rtc/rtc-tps65910.c
+++ b/drivers/rtc/rtc-tps65910.c
@@ -105,6 +105,12 @@ static int tps65910_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	struct tps65910 *tps = dev_get_drvdata(dev->parent);
 	int ret;
 
+	if ((tm->tm_year - 100) < 0) {
+		dev_err(dev, "the requested year %d is unsupported\n",
+			1900 + tm->tm_year);
+		return -EINVAL;
+	}
+
 	rtc_data[0] = bin2bcd(tm->tm_sec);
 	rtc_data[1] = bin2bcd(tm->tm_min);
 	rtc_data[2] = bin2bcd(tm->tm_hour);
-- 
2.15.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ