• Miklos Szeredi's avatar
    [PATCH] fuse: fix bitfield race · 095da6cb
    Miklos Szeredi authored
    Fix race in setting bitfields of fuse_conn.  Spotted by Andrew Morton.
    
    The two fields ->connected and ->mounted were always changed with the
    fuse_lock held.  But other bitfields in the same structure were changed
    without the lock.  In theory this could lead to losing the assignment of
    even the ones under lock.  The chosen solution is to change these two
    fields to be a full unsigned type.  The other bitfields aren't "important"
    enough to warrant the extra complexity of full locking or changing them to
    bitops.
    
    For all bitfields document why they are safe wrt. concurrent
    assignments.
    
    Also make the initialization of the 'num_waiting' atomic counter explicit.
    Signed-off-by: default avatarMiklos Szeredi <miklos@szeredi.hu>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    095da6cb
inode.c 17.6 KB