hfsplus: fix possible deadlock when handling corrupted extents
authorEric Sesterhenn <[email protected]>
Sun, 19 Oct 2008 03:28:02 +0000 (20:28 -0700)
committerLinus Torvalds <[email protected]>
Mon, 20 Oct 2008 15:52:38 +0000 (08:52 -0700)
A corrupted extent for the extent file itself may try to get an impossible
extent, causing a deadlock if I see it correctly.

Check the inode number after the first_blocks checks and fail if it's the
extent file, as according to the spec the extent file should have no
extent for itself.

Signed-off-by: Eric Sesterhenn <[email protected]>
Cc: Roman Zippel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/hfsplus/extents.c

index fec8f61227ffb28792a7b94f30417f003d786882..0022eec63cdacd97c2a438b8d9f623ff6be88dd4 100644 (file)
@@ -199,6 +199,9 @@ int hfsplus_get_block(struct inode *inode, sector_t iblock,
                goto done;
        }
 
+       if (inode->i_ino == HFSPLUS_EXT_CNID)
+               return -EIO;
+
        mutex_lock(&HFSPLUS_I(inode).extents_lock);
        res = hfsplus_ext_read_extent(inode, ablock);
        if (!res) {