]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ext4: replace BUG() with return -EIO in ext4_ext_get_blocks
authorSurbhi Palande <surbhi.palande@canonical.com>
Mon, 14 Dec 2009 14:53:52 +0000 (09:53 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 14 Dec 2009 14:53:52 +0000 (09:53 -0500)
This patch fixes the Kernel BZ #14286.  When the address of an extent
corresponding to a valid block is corrupted, a -EIO should be reported
instead of a BUG().  This situation should not normally not occur
except in the case of a corrupted filesystem.  If however it does,
then the system should not panic directly but depending on the mount
time options appropriate action should be taken. If the mount options
so permit, the I/O should be gracefully aborted by returning a -EIO.

http://bugzilla.kernel.org/show_bug.cgi?id=14286

Signed-off-by: Surbhi Palande <surbhi.palande@canonical.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/extents.c

index 3a7928f825e45f8fb244587cbe7c8921f6a3269b..8fd6c567964aa5990f0df8f8872920c2e2882206 100644 (file)
@@ -3190,7 +3190,13 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
         * this situation is possible, though, _during_ tree modification;
         * this is why assert can't be put in ext4_ext_find_extent()
         */
-       BUG_ON(path[depth].p_ext == NULL && depth != 0);
+       if (path[depth].p_ext == NULL && depth != 0) {
+               ext4_error(inode->i_sb, __func__, "bad extent address "
+                          "inode: %lu, iblock: %d, depth: %d",
+                          inode->i_ino, iblock, depth);
+               err = -EIO;
+               goto out2;
+       }
        eh = path[depth].p_hdr;
 
        ex = path[depth].p_ext;