Skip to content

Commit 78c4e17

Browse files
jeffmahoneytyhicks
authored andcommitted
Revert "ecryptfs: forbid opening files without mmap handler"
This reverts commit 2f36db7. It fixed a local root exploit but also introduced a dependency on the lower file system implementing an mmap operation just to open a file, which is a bit of a heavy hammer. The right fix is to have mmap depend on the existence of the mmap handler instead. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Cc: stable@vger.kernel.org Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
1 parent 40f0fd3 commit 78c4e17

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

fs/ecryptfs/kthread.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include <linux/slab.h>
2626
#include <linux/wait.h>
2727
#include <linux/mount.h>
28-
#include <linux/file.h>
2928
#include "ecryptfs_kernel.h"
3029

3130
struct ecryptfs_open_req {
@@ -148,7 +147,7 @@ int ecryptfs_privileged_open(struct file **lower_file,
148147
flags |= IS_RDONLY(d_inode(lower_dentry)) ? O_RDONLY : O_RDWR;
149148
(*lower_file) = dentry_open(&req.path, flags, cred);
150149
if (!IS_ERR(*lower_file))
151-
goto have_file;
150+
goto out;
152151
if ((flags & O_ACCMODE) == O_RDONLY) {
153152
rc = PTR_ERR((*lower_file));
154153
goto out;
@@ -166,16 +165,8 @@ int ecryptfs_privileged_open(struct file **lower_file,
166165
mutex_unlock(&ecryptfs_kthread_ctl.mux);
167166
wake_up(&ecryptfs_kthread_ctl.wait);
168167
wait_for_completion(&req.done);
169-
if (IS_ERR(*lower_file)) {
168+
if (IS_ERR(*lower_file))
170169
rc = PTR_ERR(*lower_file);
171-
goto out;
172-
}
173-
have_file:
174-
if ((*lower_file)->f_op->mmap == NULL) {
175-
fput(*lower_file);
176-
*lower_file = NULL;
177-
rc = -EMEDIUMTYPE;
178-
}
179170
out:
180171
return rc;
181172
}

0 commit comments

Comments
 (0)