lkml.org 
[lkml]   [2005]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH] hfsplus: don't oops on bad FS
    On 25 Apr 2005 at 21h04, Roman Zippel wrote:

    Hi,

    > Actually it looks like we are always leaking it, so actually
    > hfsplus_put_super() needs fixing, could you add the check and kfree
    > there and do the same fix for hfs?

    Mmh, right. Here's an updated version that fixes it too.

    Signed-off-by: Colin Leroy <colin@colino.net>
    --- a/fs/hfsplus/super.c 2005-04-25 21:56:56.000000000 +0200
    +++ b/fs/hfsplus/super.c 2005-04-25 21:58:39.000000000 +0200
    @@ -226,6 +226,9 @@
    brelse(HFSPLUS_SB(sb).s_vhbh);
    if (HFSPLUS_SB(sb).nls)
    unload_nls(HFSPLUS_SB(sb).nls);
    +
    + kfree((struct hfsplus_sb_info *)sb->s_fs_info);
    + sb->s_fs_info = NULL;
    }

    static int hfsplus_statfs(struct super_block *sb, struct kstatfs *buf)
    @@ -298,7 +301,7 @@
    if (!silent)
    printk("HFS+-fs: unable to parse mount options\n");
    err = -EINVAL;
    - goto cleanup;
    + goto cleanup_little;
    }

    /* temporarily use utf8 to correctly find the hidden dir below */
    @@ -307,7 +310,7 @@
    if (!nls) {
    printk("HFS+: unable to load nls for utf8\n");
    err = -EINVAL;
    - goto cleanup;
    + goto cleanup_little;
    }

    /* Grab the volume header */
    @@ -315,7 +318,7 @@
    if (!silent)
    printk("HFS+-fs: unable to find HFS+ superblock\n");
    err = -EINVAL;
    - goto cleanup;
    + goto cleanup_little;
    }
    vhdr = HFSPLUS_SB(sb).s_vhdr;

    @@ -428,8 +431,12 @@

    cleanup:
    hfsplus_put_super(sb);
    +
    +cleanup_little:
    if (nls)
    unload_nls(nls);
    + sb->s_fs_info = NULL;
    + kfree(sbi);
    return err;
    }

    --
    Colin
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-04-25 22:07    [W:0.021 / U:23.384 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site