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: <20241118174519.17951-1-dalmemail@gmail.com>
Date: Mon, 18 Nov 2024 18:45:19 +0100
From: Daniel Martín Gómez <dalmemail@...il.com>
To: dalmemail@...il.com
Cc: Luis de Bethencourt <luisbg@...nel.org>,
	Salah Triki <salah.triki@...il.com>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] befs: Fix incorrect superblock consistency check

The check assumes that blocks_per_ag records the number
of blocks in an allocation group, but section 4.5 of
Practical File System Design with the Be File System
states that "The blocks_per_ag field of the superblock
refers to the number of bitmap blocks that are in each
allocation group". This causes befs driver to write an
error to the log each time a volume is mounted. Change
the check to correctly compute the number of blocks on
each allocation group using blocks_per_ag.

Signed-off-by: Daniel Martín Gómez <dalmemail@...il.com>
---
 fs/befs/super.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/befs/super.c b/fs/befs/super.c
index 7c50025c99d8..a900ef8402af 100644
--- a/fs/befs/super.c
+++ b/fs/befs/super.c
@@ -101,9 +101,12 @@ 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, non-fatal consistency check.
+	 * Beware that blocks_per_ag holds the number of bitmap blocks in
+	 * each allocation group.
 	 */
-	if ((1 << befs_sb->ag_shift) != befs_sb->blocks_per_ag)
+	if ((1 << befs_sb->ag_shift) !=
+	    befs_sb->blocks_per_ag * befs_sb->block_size * 8)
 		befs_error(sb, "ag_shift disagrees with blocks_per_ag.");
 
 	if (befs_sb->log_start != befs_sb->log_end ||
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ