All of lore.kernel.org
 help / color / mirror / Atom feed
* [FOR STABLE 4.4] ext4: don't allow encrypted operations without keys
@ 2017-10-08 18:29 Theodore Ts'o
  2017-10-10 18:12 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Theodore Ts'o @ 2017-10-08 18:29 UTC (permalink / raw)
  To: stable

>From 85c293dc2ed8c48feef46b4c28ac68a808241cfd Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Wed, 28 Dec 2016 00:22:52 -0500
Subject: [PATCH] ext4: don't allow encrypted operations without keys

[ Upstream commit 173b8439e1ba362007315868928bf9d26e5cc5a6 ]

While we allow deletes without the key, the following should not be
permitted:

total 4
-rw-r--r-- 1 root root   0 Dec 27 22:35 6,LKNRJsp209FbXoSvJWzB
-rw-r--r-- 1 root root 286 Dec 27 22:35 uRJ5vJh9gE7vcomYMqTAyD

This fixes a failure in xfstests generic/419.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 fs/ext4/namei.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 1d007e853f5c..6445d84266fa 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -3506,6 +3506,12 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
 	int credits;
 	u8 old_file_type;
 
+	if ((ext4_encrypted_inode(old_dir) &&
+	     !ext4_has_encryption_key(old_dir)) ||
+	    (ext4_encrypted_inode(new_dir) &&
+	     !ext4_has_encryption_key(new_dir)))
+		return -ENOKEY;
+
 	retval = dquot_initialize(old.dir);
 	if (retval)
 		return retval;
@@ -3706,6 +3712,12 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
 	u8 new_file_type;
 	int retval;
 
+	if ((ext4_encrypted_inode(old_dir) &&
+	     !ext4_has_encryption_key(old_dir)) ||
+	    (ext4_encrypted_inode(new_dir) &&
+	     !ext4_has_encryption_key(new_dir)))
+		return -ENOKEY;
+
 	if ((ext4_encrypted_inode(old_dir) ||
 	     ext4_encrypted_inode(new_dir)) &&
 	    (old_dir != new_dir) &&
-- 
2.11.0.rc0.7.gbe5a750

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

* Re: [FOR STABLE 4.4] ext4: don't allow encrypted operations without keys
  2017-10-08 18:29 [FOR STABLE 4.4] ext4: don't allow encrypted operations without keys Theodore Ts'o
@ 2017-10-10 18:12 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2017-10-10 18:12 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: stable

On Sun, Oct 08, 2017 at 02:29:10PM -0400, Theodore Ts'o wrote:
> >From 85c293dc2ed8c48feef46b4c28ac68a808241cfd Mon Sep 17 00:00:00 2001
> From: Theodore Ts'o <tytso@mit.edu>
> Date: Wed, 28 Dec 2016 00:22:52 -0500
> Subject: [PATCH] ext4: don't allow encrypted operations without keys
> 
> [ Upstream commit 173b8439e1ba362007315868928bf9d26e5cc5a6 ]

Now applied, thanks.

greg k-h

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

end of thread, other threads:[~2017-10-10 18:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-08 18:29 [FOR STABLE 4.4] ext4: don't allow encrypted operations without keys Theodore Ts'o
2017-10-10 18:12 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.