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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140805010649.2611.15991.stgit@birch.djwong.org>
Date:	Mon, 04 Aug 2014 18:06:49 -0700
From:	"Darrick J. Wong" <darrick.wong@...cle.com>
To:	tytso@....edu, darrick.wong@...cle.com
Cc:	linux-ext4@...r.kernel.org
Subject: [PATCH 17/21] e2fsck: use the correct block size when salvaging
 directories

Now that the directory salvaging operation is fed the block size,
teach pass 2 that it should use the size of the inline data if the
directory is inline_data.  Without this, it'll "fix" inline
directories by setting the rec_len to something approaching the FS
blocksize, which is clearly wrong.

Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
---
 e2fsck/pass2.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)


diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index d56b4c8..abf95bd 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -979,11 +979,17 @@ skip_checksum:
 
 		problem = 0;
 		if (!inline_data_size || dot_state > 1) {
+			size_t max_block_size = fs->blocksize - de_csum_size;
+
+			if (inline_data_size)
+				max_block_size = inline_data_size;
 			dirent = (struct ext2_dir_entry *) (buf + offset);
 			(void) ext2fs_get_rec_len(fs, dirent, &rec_len);
 			cd->pctx.dirent = dirent;
 			cd->pctx.num = offset;
 			if (((offset + rec_len) > fs->blocksize) ||
+			    (inline_data_size > 0 &&
+			     (offset + rec_len) > inline_data_size) ||
 			    (rec_len < 12) ||
 			    ((rec_len % 4) != 0) ||
 			    ((ext2fs_dirent_name_len(dirent) + 8) > rec_len)) {
@@ -991,8 +997,7 @@ skip_checksum:
 						&cd->pctx)) {
 					salvage_directory(fs, dirent, prev,
 							  &offset,
-							  fs->blocksize -
-							  de_csum_size);
+							  max_block_size);
 					dir_modified++;
 					continue;
 				} else

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ