hfsplus oops on image without extends
PATCH 1/1 hfsplus oops on image without extends
hi,
the following patch fixes an oops with a corrupted hfs+ image. see http://bugzilla.kernel.org/show_bug.cgi?id=10548 for details.
Problem is that we call hfs_btree_open() from hfsplus_fill_super() to set HFSPLUS_SB(sb).[ext_tree|cat_tree]
Both trees are still NULL at this moment. If hfs_btree_open() fails for any reason it calls iput() on the page, which
gets to hfsplus_releasepage() which tries to access HFSPLUS_SB(sb).* which is still NULL and oopses while dereferencing it.
fs/hfsplus/inode.c renamed from fs/hfsplus/inode.c.orig +2 -0
@@ -65,6 +65,8 @@ static int hfsplus_releasepage(struct paBUG ();return 0 ; } + it (!tree) +return 0 ;if (tree->node_size >=PAGE_CACHE_SIZE ) { nidx = page->index >> (tree->node_size_shift -PAGE_CACHE_SHIFT );spin_lock (&tree->hash_lock);
Quoted 18 lines · Eric Sesterhenn
hi,
the following patch fixes an oops with a corrupted hfs+ image. see http://bugzilla.kernel.org/show_bug.cgi?id=10548 for details.
Problem is that we call
hfs_btree_open()fromhfsplus_fill_super()to set HFSPLUS_SB(sb).[ext_tree|cat_tree]
Both trees are still NULL at this moment. Ifhfs_btree_open()fails for any reason it callsiput()on the page, which
gets tohfsplus_releasepage()which tries to access HFSPLUS_SB(sb).* which is still NULL and oopses while dereferencing it.Signed-off-by Eric Sesterhenn <[email protected]>
fs/hfsplus/inode.c static int hfsplus_releasepage(struct pa · line 69
Quoted 5 lines
fs/hfsplus/inode.c renamed from fs/hfsplus/inode.c.orig +2
-0@@ -65,6 +65,8 @@ static int hfsplus_releasepage(struct paBUG ();return 0 ; } + it (!tree) +return 0 ;
Erm, I presume this is meant to be 'if', checkpatch whined about the space as it thought it was a function. I guess this hasn't been compile tested?
fs/hfsplus/inode.c static int hfsplus_releasepage(struct pa · line 72
Quoted 3 lines
fs/hfsplus/inode.c renamed from fs/hfsplus/inode.c.orig +0
-0if (tree->node_size >=PAGE_CACHE_SIZE ) { nidx = page->index >> (tree->node_size_shift -PAGE_CACHE_SHIFT );spin_lock (&tree->hash_lock);
-apw
Quoted 13 lines · * Andy Whitcroft ([email protected]) wrote:
Quoted 11 lines · Eric Sesterhenn
hi,
the following patch fixes an oops with a corrupted hfs+ image. see http://bugzilla.kernel.org/show_bug.cgi?id=10548 for details.
Problem is that we call
hfs_btree_open()fromhfsplus_fill_super()to set HFSPLUS_SB(sb).[ext_tree|cat_tree]
Both trees are still NULL at this moment. Ifhfs_btree_open()fails for any reason it callsiput()on the page, which
gets tohfsplus_releasepage()which tries to access HFSPLUS_SB(sb).* which is still NULL and oopses while dereferencing it.
Quoted 3 lines
Erm, I presume this is meant to be 'if', checkpatch whined about the space as it thought it was a function. I guess this hasn't been compile tested?
sorry, i messed this up, didnt have the original patch anymore and quickly recreated it. Andrew already put a fix in -mm
Greetings, Eric