Skip to content

Commit

Permalink
hfsplus: fix possible deadlock when handling corrupted extents
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
SesterhennEric authored and torvalds committed Oct 20, 2008
1 parent 6e71529 commit 248736c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/hfsplus/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 248736c

Please sign in to comment.