linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ubifs: Use FS_CFLG_OWN_PAGES
@ 2016-12-12 23:27 Richard Weinberger
  2016-12-12 23:27 ` [PATCH 2/2] ubifs: Use fscrypt ioctl() helpers Richard Weinberger
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Weinberger @ 2016-12-12 23:27 UTC (permalink / raw)
  To: linux-mtd
  Cc: linux-kernel, adrian.hunter, dedekind1, david, Richard Weinberger

Commit bd7b8290388d ("fscrypt: Cleanup page locking requirements for
fscrypt_{decrypt,encrypt}_page()") renamed the flag.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 fs/ubifs/crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ubifs/crypto.c b/fs/ubifs/crypto.c
index aefa3c30b73b..3402720f2b28 100644
--- a/fs/ubifs/crypto.c
+++ b/fs/ubifs/crypto.c
@@ -87,7 +87,7 @@ int ubifs_decrypt(const struct inode *inode, struct ubifs_data_node *dn,
 }
 
 struct fscrypt_operations ubifs_crypt_operations = {
-	.flags			= FS_CFLG_INPLACE_ENCRYPTION,
+	.flags			= FS_CFLG_OWN_PAGES,
 	.get_context		= ubifs_crypt_get_context,
 	.set_context		= ubifs_crypt_set_context,
 	.is_encrypted		= __ubifs_crypt_is_encrypted,
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ubifs: Use fscrypt ioctl() helpers
  2016-12-12 23:27 [PATCH 1/2] ubifs: Use FS_CFLG_OWN_PAGES Richard Weinberger
@ 2016-12-12 23:27 ` Richard Weinberger
  2016-12-13 18:39   ` David Gstir
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Weinberger @ 2016-12-12 23:27 UTC (permalink / raw)
  To: linux-mtd
  Cc: linux-kernel, adrian.hunter, dedekind1, david, Richard Weinberger

Commit db717d8e26c2 ("fscrypto: move ioctl processing more fully into
common code") moved ioctl() related functions into fscrypt and offers
us now a set of helper functions.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 fs/ubifs/ioctl.c | 24 ++----------------------
 fs/ubifs/ubifs.h |  4 ++--
 2 files changed, 4 insertions(+), 24 deletions(-)

diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c
index 3d10f5525274..78d713644df3 100644
--- a/fs/ubifs/ioctl.c
+++ b/fs/ubifs/ioctl.c
@@ -184,39 +184,19 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	case FS_IOC_SET_ENCRYPTION_POLICY: {
 #ifdef CONFIG_UBIFS_FS_ENCRYPTION
 		struct ubifs_info *c = inode->i_sb->s_fs_info;
-		struct fscrypt_policy policy;
-
-		if (copy_from_user(&policy,
-				   (struct fscrypt_policy __user *)arg,
-				   sizeof(policy)))
-			return -EFAULT;
 
 		err = ubifs_enable_encryption(c);
 		if (err)
 			return err;
 
-		err = fscrypt_process_policy(file, &policy);
-
-		return err;
+		return fscrypt_ioctl_set_policy(file, (const void __user *)arg);
 #else
 		return -EOPNOTSUPP;
 #endif
 	}
 	case FS_IOC_GET_ENCRYPTION_POLICY: {
 #ifdef CONFIG_UBIFS_FS_ENCRYPTION
-		struct fscrypt_policy policy;
-
-		if (!ubifs_crypt_is_encrypted(inode))
-			return -ENOENT;
-
-		err = fscrypt_get_policy(inode, &policy);
-		if (err)
-			return err;
-
-		if (copy_to_user((void __user *)arg, &policy, sizeof(policy)))
-			return -EFAULT;
-
-		return 0;
+		return fscrypt_ioctl_get_policy(file, (void __user *)arg);
 #else
 		return -EOPNOTSUPP;
 #endif
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 8d0e4818e3ea..ca72382ce6cc 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1806,8 +1806,8 @@ int ubifs_decompress(const struct ubifs_info *c, const void *buf, int len,
 #define fscrypt_pullback_bio_page       fscrypt_notsupp_pullback_bio_page
 #define fscrypt_restore_control_page    fscrypt_notsupp_restore_control_page
 #define fscrypt_zeroout_range           fscrypt_notsupp_zeroout_range
-#define fscrypt_process_policy          fscrypt_notsupp_process_policy
-#define fscrypt_get_policy              fscrypt_notsupp_get_policy
+#define fscrypt_ioctl_set_policy	fscrypt_notsupp_ioctl_set_policy
+#define fscrypt_ioctl_get_policy	fscrypt_notsupp_ioctl_get_policy
 #define fscrypt_has_permitted_context   fscrypt_notsupp_has_permitted_context
 #define fscrypt_inherit_context         fscrypt_notsupp_inherit_context
 #define fscrypt_get_encryption_info     fscrypt_notsupp_get_encryption_info
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] ubifs: Use fscrypt ioctl() helpers
  2016-12-12 23:27 ` [PATCH 2/2] ubifs: Use fscrypt ioctl() helpers Richard Weinberger
@ 2016-12-13 18:39   ` David Gstir
  0 siblings, 0 replies; 3+ messages in thread
From: David Gstir @ 2016-12-13 18:39 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd, linux-kernel, adrian.hunter, dedekind1


> On 13.12.2016, at 00:27, Richard Weinberger <richard@nod.at> wrote:
> 
> Commit db717d8e26c2 ("fscrypto: move ioctl processing more fully into
> common code") moved ioctl() related functions into fscrypt and offers
> us now a set of helper functions.
> 
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
> fs/ubifs/ioctl.c | 24 ++----------------------
> fs/ubifs/ubifs.h |  4 ++--
> 2 files changed, 4 insertions(+), 24 deletions(-)
> 
> diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c
> index 3d10f5525274..78d713644df3 100644
> --- a/fs/ubifs/ioctl.c
> +++ b/fs/ubifs/ioctl.c
> @@ -184,39 +184,19 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> 	case FS_IOC_SET_ENCRYPTION_POLICY: {
> #ifdef CONFIG_UBIFS_FS_ENCRYPTION
> 		struct ubifs_info *c = inode->i_sb->s_fs_info;
> -		struct fscrypt_policy policy;
> -
> -		if (copy_from_user(&policy,
> -				   (struct fscrypt_policy __user *)arg,
> -				   sizeof(policy)))
> -			return -EFAULT;
> 
> 		err = ubifs_enable_encryption(c);
> 		if (err)
> 			return err;
> 
> -		err = fscrypt_process_policy(file, &policy);
> -
> -		return err;
> +		return fscrypt_ioctl_set_policy(file, (const void __user *)arg);
> #else
> 		return -EOPNOTSUPP;
> #endif
> 	}
> 	case FS_IOC_GET_ENCRYPTION_POLICY: {
> #ifdef CONFIG_UBIFS_FS_ENCRYPTION
> -		struct fscrypt_policy policy;
> -
> -		if (!ubifs_crypt_is_encrypted(inode))
> -			return -ENOENT;
> -
> -		err = fscrypt_get_policy(inode, &policy);
> -		if (err)
> -			return err;
> -
> -		if (copy_to_user((void __user *)arg, &policy, sizeof(policy)))
> -			return -EFAULT;
> -
> -		return 0;
> +		return fscrypt_ioctl_get_policy(file, (void __user *)arg);
> #else
> 		return -EOPNOTSUPP;
> #endif
> diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
> index 8d0e4818e3ea..ca72382ce6cc 100644
> --- a/fs/ubifs/ubifs.h
> +++ b/fs/ubifs/ubifs.h
> @@ -1806,8 +1806,8 @@ int ubifs_decompress(const struct ubifs_info *c, const void *buf, int len,
> #define fscrypt_pullback_bio_page       fscrypt_notsupp_pullback_bio_page
> #define fscrypt_restore_control_page    fscrypt_notsupp_restore_control_page
> #define fscrypt_zeroout_range           fscrypt_notsupp_zeroout_range
> -#define fscrypt_process_policy          fscrypt_notsupp_process_policy
> -#define fscrypt_get_policy              fscrypt_notsupp_get_policy
> +#define fscrypt_ioctl_set_policy	fscrypt_notsupp_ioctl_set_policy
> +#define fscrypt_ioctl_get_policy	fscrypt_notsupp_ioctl_get_policy
> #define fscrypt_has_permitted_context   fscrypt_notsupp_has_permitted_context
> #define fscrypt_inherit_context         fscrypt_notsupp_inherit_context
> #define fscrypt_get_encryption_info     fscrypt_notsupp_get_encryption_info
> -- 
> 2.10.2

Looks good to me.

Reviewed-by: David Gstir <david@sigma-star.at>

- David

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-13 18:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-12 23:27 [PATCH 1/2] ubifs: Use FS_CFLG_OWN_PAGES Richard Weinberger
2016-12-12 23:27 ` [PATCH 2/2] ubifs: Use fscrypt ioctl() helpers Richard Weinberger
2016-12-13 18:39   ` David Gstir

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).