• Jeff Mahoney's avatar
    reiserfs: fix xattr root locking/refcount bug · 9b7f3755
    Jeff Mahoney authored
    The listxattr() and getxattr() operations are only protected by a read
    lock.  As a result, if either of these operations run in parallel, a race
    condition exists where the xattr_root will end up being cached twice, which
    results in the leaking of a reference and a BUG() on umount.
    
    This patch refactors get_xa_root(), __get_xa_root(), and create_xa_root(),
    into one get_xa_root() function that takes the appropriate locking around
    the entire critical section.
    
    Reported, diagnosed and tested by Andrea Righi <a.righi@cineca.it>
    Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
    Cc: Andrea Righi <a.righi@cineca.it>
    Cc: "Vladimir V. Saveliev" <vs@namesys.com>
    Cc: Edward Shishkin <edward@namesys.com>
    Cc: Alex Zarochentsev <zam@namesys.com>
    Cc: <stable@kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    9b7f3755
xattr.c 32.9 KB