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]
Message-ID: <20251112082114.1105-1-vulab@iscas.ac.cn>
Date: Wed, 12 Nov 2025 16:21:13 +0800
From: Haotian Zhang <vulab@...as.ac.cn>
To: Bob Copeland <me@...copeland.com>
Cc: linux-karma-devel@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org,
	Haotian Zhang <vulab@...as.ac.cn>
Subject: [PATCH] omfs: check sb_set_blocksize return value

The code validates that sbi->s_sys_blocksize does not exceed PAGE_SIZE,
but fails to verify that the block size is a power of two, which could
lead to memory corruption or system crashes.

Check the return value of sb_set_blocksize() and return -EINVAL on failure.

Fixes: 555e3775ced1 ("omfs: add inode routines")
Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
---
 fs/omfs/inode.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index 135c49c5d848..24f58d10a93e 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -523,7 +523,11 @@ static int omfs_fill_super(struct super_block *sb, struct fs_context *fc)
 	 * Use sys_blocksize as the fs block since it is smaller than a
 	 * page while the fs blocksize can be larger.
 	 */
-	sb_set_blocksize(sb, sbi->s_sys_blocksize);
+	if (!sb_set_blocksize(sb, sbi->s_sys_blocksize)) {
+		pr_err("omfs: Invalid system block size %d\n",
+				sbi->s_sys_blocksize);
+		goto out_brelse_bh;
+	}
 
 	/*
 	 * ...and the difference goes into a shift.  sys_blocksize is always
-- 
2.50.1.windows.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ