• Thomas Gleixner's avatar
    [JFFS2] Fix the slab cache constructor of 'struct jffs2_inode_info' objects. · 21eeb7aa
    Thomas Gleixner authored
    JFFS2 initialize f->sem mutex as "locked" in the slab constructor which is a
    bug. Objects are freed with unlocked f->sem mutex. So, when they allocated
    again, f->sem is unlocked because the slab cache constructor is not called for
    them. The constructor is called only once when memory pages are allocated for
    objects (namely, when the slab layer allocates new slabs). So, sometimes
    'struct jffs2_inode_info' are allocated with unlocked f->sem, sometimes with
    locked. This is a bug. Instead, initialize f->sem as unlocked in the
    constructor. I.e., in the "constructed" state f->sem must be unlocked.
    
    From: Keijiro Yano <keijiro_yano@yahoo.co.jp>
    Acked-by: default avatarArtem B. Bityutskiy <dedekind@infradead.org>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    21eeb7aa
super.c 9.48 KB