summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0098-eCryptfs-Properly-check-for-O_RDONLY-flag-before-doi.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0098-eCryptfs-Properly-check-for-O_RDONLY-flag-before-doi.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0098-eCryptfs-Properly-check-for-O_RDONLY-flag-before-doi.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0098-eCryptfs-Properly-check-for-O_RDONLY-flag-before-doi.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0098-eCryptfs-Properly-check-for-O_RDONLY-flag-before-doi.patch
new file mode 100644
index 00000000..2758ec07
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0098-eCryptfs-Properly-check-for-O_RDONLY-flag-before-doi.patch
@@ -0,0 +1,45 @@
1From 590d0b9de4bb4ef7a84bb0a8a13d85353556e7ae Mon Sep 17 00:00:00 2001
2From: Tyler Hicks <tyhicks@canonical.com>
3Date: Tue, 12 Jun 2012 11:17:01 -0700
4Subject: [PATCH 098/109] eCryptfs: Properly check for O_RDONLY flag before
5 doing privileged open
6
7commit 9fe79d7600497ed8a95c3981cbe5b73ab98222f0 upstream.
8
9If the first attempt at opening the lower file read/write fails,
10eCryptfs will retry using a privileged kthread. However, the privileged
11retry should not happen if the lower file's inode is read-only because a
12read/write open will still be unsuccessful.
13
14The check for determining if the open should be retried was intended to
15be based on the access mode of the lower file's open flags being
16O_RDONLY, but the check was incorrectly performed. This would cause the
17open to be retried by the privileged kthread, resulting in a second
18failed open of the lower file. This patch corrects the check to
19determine if the open request should be handled by the privileged
20kthread.
21
22Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
23Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
24Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
25Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
26---
27 fs/ecryptfs/kthread.c | 2 +-
28 1 files changed, 1 insertions(+), 1 deletions(-)
29
30diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c
31index 69f994a..0dbe58a 100644
32--- a/fs/ecryptfs/kthread.c
33+++ b/fs/ecryptfs/kthread.c
34@@ -149,7 +149,7 @@ int ecryptfs_privileged_open(struct file **lower_file,
35 (*lower_file) = dentry_open(lower_dentry, lower_mnt, flags, cred);
36 if (!IS_ERR(*lower_file))
37 goto out;
38- if (flags & O_RDONLY) {
39+ if ((flags & O_ACCMODE) == O_RDONLY) {
40 rc = PTR_ERR((*lower_file));
41 goto out;
42 }
43--
441.7.7.6
45