linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] f2fs crypto: allow setting encryption policy once
@ 2015-05-25 10:09 Chao Yu
  0 siblings, 0 replies; only message in thread
From: Chao Yu @ 2015-05-25 10:09 UTC (permalink / raw)
  To: Jaegeuk Kim, Changman Lee; +Cc: linux-f2fs-devel, linux-kernel

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>
---
 fs/f2fs/crypto_policy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/crypto_policy.c b/fs/f2fs/crypto_policy.c
index 56b2ac0..71b3a5a 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);
 }
-- 
2.3.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-25 10:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-25 10:09 [PATCH 3/3] f2fs crypto: allow setting encryption policy once Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).