diff options
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.patch | 45 |
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 @@ | |||
1 | From 590d0b9de4bb4ef7a84bb0a8a13d85353556e7ae Mon Sep 17 00:00:00 2001 | ||
2 | From: Tyler Hicks <tyhicks@canonical.com> | ||
3 | Date: Tue, 12 Jun 2012 11:17:01 -0700 | ||
4 | Subject: [PATCH 098/109] eCryptfs: Properly check for O_RDONLY flag before | ||
5 | doing privileged open | ||
6 | |||
7 | commit 9fe79d7600497ed8a95c3981cbe5b73ab98222f0 upstream. | ||
8 | |||
9 | If the first attempt at opening the lower file read/write fails, | ||
10 | eCryptfs will retry using a privileged kthread. However, the privileged | ||
11 | retry should not happen if the lower file's inode is read-only because a | ||
12 | read/write open will still be unsuccessful. | ||
13 | |||
14 | The check for determining if the open should be retried was intended to | ||
15 | be based on the access mode of the lower file's open flags being | ||
16 | O_RDONLY, but the check was incorrectly performed. This would cause the | ||
17 | open to be retried by the privileged kthread, resulting in a second | ||
18 | failed open of the lower file. This patch corrects the check to | ||
19 | determine if the open request should be handled by the privileged | ||
20 | kthread. | ||
21 | |||
22 | Signed-off-by: Tyler Hicks <tyhicks@canonical.com> | ||
23 | Reported-by: Dan Carpenter <dan.carpenter@oracle.com> | ||
24 | Acked-by: Dan Carpenter <dan.carpenter@oracle.com> | ||
25 | Signed-off-by: Ben Hutchings <ben@decadent.org.uk> | ||
26 | --- | ||
27 | fs/ecryptfs/kthread.c | 2 +- | ||
28 | 1 files changed, 1 insertions(+), 1 deletions(-) | ||
29 | |||
30 | diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c | ||
31 | index 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 | -- | ||
44 | 1.7.7.6 | ||
45 | |||