Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1370105

[PATCH 11/13] fscrypto: restrict setting encryption policy to inode owner

From Eric Biggers <ebiggers3@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 11/13] fscrypto: restrict setting encryption policy to inode owner
Date 2016-04-03 07:30 +0200
Message-ID <rjILM-748-21@gated-at.bofh.it> (permalink)
References <rjILL-748-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On a filesystem with encryption enabled, a user could set an encryption
policy on any empty directory to which they have readonly access.  This
is a potential security issue since such a directory might be owned by
another user, and the new encryption policy may prevent that user from
creating files in their own directory.

Fix this by requiring inode_owner_or_capable() permission to set an
encryption policy.

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
---
 fs/crypto/policy.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/crypto/policy.c b/fs/crypto/policy.c
index cb5ba27..3f5c275 100644
--- a/fs/crypto/policy.c
+++ b/fs/crypto/policy.c
@@ -96,6 +96,9 @@ int fscrypt_set_policy(struct inode *inode, const struct fscrypt_policy *policy)
 {
 	int ret = 0;
 
+	if (!inode_owner_or_capable(inode))
+		return -EACCES;
+
 	if (policy->version != 0)
 		return -EINVAL;
 
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/13] fscrypto: cleanups and fixes Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 12/13] fscrypto: require write access to mount to set encryption policy Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 04/13] fscrypto: return bool instead of int where appropriate Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 10/13] fscrypto: restrict setting new policy to empty files and directories only Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 05/13] fscrypto: comment improvements and fixes Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 07/13] fscrypto: simplify building key descriptor string Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 02/13] fscrypto: rename some functions for clarity Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
    Re: [PATCH 02/13] fscrypto: rename some functions for clarity Theodore Ts'o <tytso@mit.edu> - 2016-04-03 09:50 +0200
  [PATCH 11/13] fscrypto: restrict setting encryption policy to inode owner Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 08/13] fscrypto: use standard macros from kernel.h Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 09/13] fscrypto: make fname_encrypt() actually return length of ciphertext Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 13/13] fscrypto: improve error handling in fscrypt_set_policy() Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 06/13] fscrypto: crypto_alloc_skcipher() always returns an ERR_PTR(), never NULL Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200
  [PATCH 03/13] fscrypto: rename functions to load and unload inode encryption info Eric Biggers <ebiggers3@gmail.com> - 2016-04-03 07:30 +0200

csiph-web