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]
Date:	Fri, 12 Aug 2016 11:12:31 +0100
From:	Salah Triki <salah.triki@...il.com>
To:	akpm@...ux-foundation.org, viro@...iv.linux.org.uk,
	luisbg@....samsung.com
Cc:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	salah.triki@...il.com
Subject: [PATCH] befs: return BEFS_ERR if validation of ag_shift fails

ag_shift is used by blockno2iaddr() to get allocation group number
from block. If ag_shift is inconsistent with block_per_ag, an out of
bounds allocation group may occur [1]. So add return BEFS_ERR and update
comment and error message to reflect this change.

[1] https://lkml.org/lkml/2016/8/12/42

Signed-off-by: Salah Triki <salah.triki@...il.com>
---
 fs/befs/super.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/befs/super.c b/fs/befs/super.c
index 7c50025..2e3a3fd 100644
--- a/fs/befs/super.c
+++ b/fs/befs/super.c
@@ -101,10 +101,13 @@ befs_check_sb(struct super_block *sb)
 
 
 	/* ag_shift also encodes the same information as blocks_per_ag in a
-	 * different way, non-fatal consistency check
+	 * different way as a consistency check.
 	 */
-	if ((1 << befs_sb->ag_shift) != befs_sb->blocks_per_ag)
-		befs_error(sb, "ag_shift disagrees with blocks_per_ag.");
+	if ((1 << befs_sb->ag_shift) != befs_sb->blocks_per_ag) {
+		befs_error(sb, "ag_shift disagrees with blocks_per_ag. "
+			   "Corruption likely.");
+		return BEFS_ERR;
+	}
 
 	if (befs_sb->log_start != befs_sb->log_end ||
 	    befs_sb->flags == BEFS_DIRTY) {
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ