From: Eric Sesterhenn Date: Sun, 19 Oct 2008 03:28:02 +0000 (-0700) Subject: hfsplus: fix possible deadlock when handling corrupted extents X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=248736c2a57206388c86f8cdd3392ee986e84f9f;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git hfsplus: fix possible deadlock when handling corrupted extents 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 Cc: Roman Zippel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index fec8f61227ff..0022eec63cda 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c @@ -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) {