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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230527101851.3266500-1-linan666@huaweicloud.com>
Date:   Sat, 27 May 2023 18:18:50 +0800
From:   linan666@...weicloud.com
To:     song@...nel.org
Cc:     linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
        linan122@...wei.com, yukuai3@...wei.com, yi.zhang@...wei.com,
        houtao1@...wei.com, yangerkun@...wei.com
Subject: [PATCH] md/bitmap: check input value with ULONG_MAX in timeout_store

From: Li Nan <linan122@...wei.com>

The type of timeout is unsigned long, but it is compared with 'LONG_MAX'
in timeout_store(), which lead to value within (LONG_MAX, ULONG_MAX.]/HZ
can't be set. Fix it by checking input value with ULONG_MAX.

Signed-off-by: Li Nan <linan122@...wei.com>
---
 drivers/md/md-bitmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index bc8d7565171d..5fd9cba65be8 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -2460,7 +2460,7 @@ timeout_store(struct mddev *mddev, const char *buf, size_t len)
 		return rv;
 
 	/* just to make sure we don't overflow... */
-	if (timeout >= LONG_MAX / HZ)
+	if (timeout >= ULONG_MAX / HZ)
 		return -EINVAL;
 
 	timeout = timeout * HZ / 10000;
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ