• Al Viro's avatar
    ubifs: fix sget races · d251ed27
    Al Viro authored
    * allocate ubifs_info in ->mount(), fill it enough for sb_test() and
    set ->s_fs_info to it in set() callback passed to sget().
    * do *not* free it in ->put_super(); do that in ->kill_sb() after we'd
    done kill_anon_super().
    * don't free it in ubifs_fill_super() either - deactivate_locked_super()
    done by caller when ubifs_fill_super() returns an error will take care
    of that sucker.
    * get rid of kludge with passing ubi to ubifs_fill_super() in ->s_fs_info;
    we only need it in alloc_ubifs_info(), so ubifs_fill_super() will need
    only ubifs_info.  Which it will find in ->s_fs_info just fine, no need to
    reassign anything...
    
    As the result, sb_test() becomes safe to apply to all superblocks that
    can be found by sget() (and a kludge with temporary use of ->s_fs_info
    to store a pointer to very different structure goes away).
    Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
    d251ed27
super.c 60.4 KB