diff options
author | Chao Yu <chao2.yu@samsung.com> | 2015-05-25 12:09:03 +0200 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-06-02 01:21:06 +0200 |
commit | 81b0a8ffaa92012e63ea611e8aeb9e74acfcedac (patch) | |
tree | e221f74861a7329db0d80a771d3fad2afa80dc90 /fs | |
parent | f2fs crypto: check context consistent for rename2 (diff) | |
download | linux-81b0a8ffaa92012e63ea611e8aeb9e74acfcedac.tar.xz linux-81b0a8ffaa92012e63ea611e8aeb9e74acfcedac.zip |
f2fs crypto: allow setting encryption policy once
This patch add XATTR_CREATE flag in setxattr when setting encryption
context for inode. Without this flag the context could be set more than
once, this should never happen. So, fix it.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/crypto_policy.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/f2fs/crypto_policy.c b/fs/f2fs/crypto_policy.c index bef254b21815..30b0b73d4200 100644 --- a/fs/f2fs/crypto_policy.c +++ b/fs/f2fs/crypto_policy.c @@ -83,7 +83,7 @@ static int f2fs_create_encryption_context_from_policy( return f2fs_setxattr(inode, F2FS_XATTR_INDEX_ENCRYPTION, F2FS_XATTR_NAME_ENCRYPTION_CONTEXT, &ctx, - sizeof(ctx), NULL, 0); + sizeof(ctx), NULL, XATTR_CREATE); } int f2fs_process_policy(const struct f2fs_encryption_policy *policy, @@ -202,5 +202,5 @@ int f2fs_inherit_context(struct inode *parent, struct inode *child, get_random_bytes(ctx.nonce, F2FS_KEY_DERIVATION_NONCE_SIZE); return f2fs_setxattr(child, F2FS_XATTR_INDEX_ENCRYPTION, F2FS_XATTR_NAME_ENCRYPTION_CONTEXT, &ctx, - sizeof(ctx), ipage, 0); + sizeof(ctx), ipage, XATTR_CREATE); } |