staging: erofs: fix race of initializing xattrs of a inode at the same time
authorGao Xiang <gaoxiang25@huawei.com>
Mon, 18 Feb 2019 07:19:04 +0000 (15:19 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Feb 2019 10:20:55 +0000 (11:20 +0100)
commit62dc45979f3f8cb0ea67302a93bff686f0c46c5a
tree51eacdc5461cdf651eab37a0277e96e08e0bff0a
parent17b7abbf1e3bf143027352a5da38611c9c4e8c96
staging: erofs: fix race of initializing xattrs of a inode at the same time

In real scenario, there could be several threads accessing xattrs
of the same xattr-uninitialized inode, and init_inode_xattrs()
almost at the same time.

That's actually an unexpected behavior, this patch closes the race.

Fixes: b17500a0fdba ("staging: erofs: introduce xattr & acl support")
Cc: <stable@vger.kernel.org> # 4.19+
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/erofs/internal.h
drivers/staging/erofs/xattr.c