rpms/kernel/devel linux-2.6-ext4-extent-header-check-fix.patch, NONE, 1.1 kernel.spec, 1.1414, 1.1415

Eric Sandeen sandeen at fedoraproject.org
Wed Mar 11 19:31:24 UTC 2009


Author: sandeen

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28333

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-ext4-extent-header-check-fix.patch 
Log Message:
* Wed Mar 11 2009 Eric Sandeen <sandeen at redhat.com> 2.6.29-0.235.rc7.git4
- Fix incorrect header check values in ext4_ext_search_right()
  Should address kernel.org bugzilla #12821


linux-2.6-ext4-extent-header-check-fix.patch:

--- NEW FILE linux-2.6-ext4-extent-header-check-fix.patch ---
This should resolve kernel.org bugzilla 12821

I've not actually crafted a workload to exercise this code; 
this is from inspection...

The ext4_ext_search_right() function is confusing; it uses a
"depth" variable which is 0 at the root and maximum at the leaves, 
but the on-disk metadata uses a "depth" (actually eh_depth) which
is opposite: maximum at the root, and 0 at the leaves.

The ext4_ext_check_header() function is given a depth and checks
the header agaisnt that depth; it expects the on-disk semantics,
but we are giving it the opposite in the while loop in this 
function.  We should be giving it the on-disk notion of "depth"
which we can get from (p_depth - depth) - and if you look, the last
(more commonly hit) call to ext4_ext_check_header() does just this.

Sending in the wrong depth results in (incorrect) messages
about corruption:

EXT4-fs error (device sdb1): ext4_ext_search_right: bad header
in inode #2621457: unexpected eh_depth - magic f30a, entries 340,
max 340(0), depth 1(2)

Reported-by: David Dindorp <ddi at dubex.dk>
Signed-off-by: Eric Sandeen <sandeen at redhat.com>
--

Index: linux-2.6/fs/ext4/extents.c
===================================================================
--- linux-2.6.orig/fs/ext4/extents.c
+++ linux-2.6/fs/ext4/extents.c
@@ -1122,7 +1122,8 @@ ext4_ext_search_right(struct inode *inod
 	struct ext4_extent_idx *ix;
 	struct ext4_extent *ex;
 	ext4_fsblk_t block;
-	int depth, ee_len;
+	int depth;	/* Note, NOT eh_depth; depth from top of tree */
+	int ee_len;
 
 	BUG_ON(path == NULL);
 	depth = path->p_depth;
@@ -1179,7 +1180,8 @@ got_index:
 		if (bh == NULL)
 			return -EIO;
 		eh = ext_block_hdr(bh);
-		if (ext4_ext_check_header(inode, eh, depth)) {
+		/* subtract from p_depth to get proper eh_depth */
+		if (ext4_ext_check_header(inode, eh, path->p_depth - depth)) {
 			put_bh(bh);
 			return -EIO;
 		}

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



Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1414
retrieving revision 1.1415
diff -u -r1.1414 -r1.1415
--- kernel.spec	11 Mar 2009 19:07:59 -0000	1.1414
+++ kernel.spec	11 Mar 2009 19:30:54 -0000	1.1415
@@ -686,6 +686,7 @@
 Patch2900: linux-2.6-v4l-dvb-update.patch
 
 # ext4 fixes
+Patch2910: linux-2.6-ext4-extent-header-check-fix.patch
 
 Patch9001: revert-fix-modules_install-via-nfs.patch
 
@@ -1109,6 +1110,7 @@
 #
 
 # ext4
+ApplyPatch linux-2.6-ext4-extent-header-check-fix.patch
 
 # xfs
 
@@ -1828,6 +1830,10 @@
 # and build.
 
 %changelog
+* Wed Mar 11 2009 Eric Sandeen <sandeen at redhat.com> 2.6.29-0.235.rc7.git4
+- Fix incorrect header check values in ext4_ext_search_right()
+  Should address kernel.org bugzilla #12821
+
 * Wed Mar 11 2009 Kyle McMartin <kyle at redhat.com> 2.6.29-0.234.rc7.git4
 - ingo-fix-atom-failures.patch:
    Work around Atom errata when splitting large pages.




More information about the fedora-extras-commits mailing list