hfsplus: Fix kfree of wrong pointers in hfsplus_fill_super() error path
authorSeth Forshee <seth.forshee@canonical.com>
Thu, 15 Sep 2011 14:48:27 +0000 (10:48 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 25 Oct 2011 05:10:17 +0000 (07:10 +0200)
commit f588c960fcaa6fa8bf82930bb819c9aca4eb9347 upstream.

Commit 6596528e391a ("hfsplus: ensure bio requests are not smaller than
the hardware sectors") changed the pointers used for volume header
allocations but failed to free the correct pointers in the error path
path of hfsplus_fill_super() and hfsplus_read_wrapper.

The second hunk came from a separate patch by Pavel Ivanov.

Reported-by: Pavel Ivanov <paivanof@gmail.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Christoph Hellwig <hch@tuxera.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/hfsplus/super.c
fs/hfsplus/wrapper.c

index ab4857b81af4c8f875e6401779f691ccc71a85b7..c3a76fd25f2f27c8be8d282b4ca1eb4d0e3c6b35 100644 (file)
@@ -508,8 +508,8 @@ out_close_cat_tree:
 out_close_ext_tree:
        hfs_btree_close(sbi->ext_tree);
 out_free_vhdr:
-       kfree(sbi->s_vhdr);
-       kfree(sbi->s_backup_vhdr);
+       kfree(sbi->s_vhdr_buf);
+       kfree(sbi->s_backup_vhdr_buf);
 out_unload_nls:
        unload_nls(sbi->nls);
        unload_nls(nls);
index e3881a17a5aa8037423b43c4076afd7fa4ab9dd4..7b8112da285af85a68fc41a53cd80d47ff92109b 100644 (file)
@@ -275,9 +275,9 @@ reread:
        return 0;
 
 out_free_backup_vhdr:
-       kfree(sbi->s_backup_vhdr);
+       kfree(sbi->s_backup_vhdr_buf);
 out_free_vhdr:
-       kfree(sbi->s_vhdr);
+       kfree(sbi->s_vhdr_buf);
 out:
        return error;
 }