ubifs: make ubifs_[get|set]xattr atomic
authorDongsheng Yang <yangds.fnst@cn.fujitsu.com>
Tue, 18 Aug 2015 04:38:36 +0000 (12:38 +0800)
committerRichard Weinberger <richard@nod.at>
Sat, 7 Nov 2015 10:33:17 +0000 (11:33 +0100)
commitab92a20bce3b4c21927cc1ae514c482f50ad3487
tree5979820c9a40bf54a7542a3df9f75c0482aea70b
parent54bcfdf19ec7c2f2788fa76426c91abdc4dab973
ubifs: make ubifs_[get|set]xattr atomic

This commit make the ubifs_[get|set]xattr protected by ui_mutex.

Originally, there is a possibility that ubifs_getxattr to get
a wrong value.

  P1                                  P2
----------                   ----------
ubifs_getxattr                      ubifs_setxattr
- kfree()
- memcpy()
- kmemdup()

Then ubifs_getxattr() would get a non-sense data. To solve this
problem, this commit make the xattr of ubifs_inode updated in
atomic.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
fs/ubifs/xattr.c