summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2016-09-29 20:11:03 +0200
committerRichard Weinberger <richard@nod.at>2016-12-12 23:07:38 +0100
commit700eada82a349f0aeadd43ce4b182b32e4adc5b5 (patch)
tree5de3b50493243a419fe8a14cdac81f7b0fd4cbe1
parentubifs: Preload crypto context in ->lookup() (diff)
downloadlinux-700eada82a349f0aeadd43ce4b182b32e4adc5b5.tar.xz
linux-700eada82a349f0aeadd43ce4b182b32e4adc5b5.zip
ubifs: Massage assert in ubifs_xattr_set() wrt. fscrypto
When we're creating a new inode in UBIFS the inode is not yet exposed and fscrypto calls ubifs_xattr_set() without holding the inode mutex. This is okay but ubifs_xattr_set() has to know about this. Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--fs/ubifs/xattr.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index 77ffc9788f45..da59ea3b50c4 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -289,7 +289,13 @@ int ubifs_xattr_set(struct inode *host, const char *name, const void *value,
union ubifs_key key;
int err;
- ubifs_assert(inode_is_locked(host));
+ /*
+ * Creating an encryption context is done unlocked since we
+ * operate on a new inode which is not visible to other users
+ * at this point.
+ */
+ if (strcmp(name, UBIFS_XATTR_NAME_ENCRYPTION_CONTEXT) != 0)
+ ubifs_assert(inode_is_locked(host));
if (size > UBIFS_MAX_INO_DATA)
return -ERANGE;