]> git.baikalelectronics.ru Git - kernel.git/commit
eCryptfs: Properly check for O_RDONLY flag before doing privileged open
authorTyler Hicks <tyhicks@canonical.com>
Tue, 12 Jun 2012 18:17:01 +0000 (11:17 -0700)
committerTyler Hicks <tyhicks@canonical.com>
Tue, 3 Jul 2012 23:34:09 +0000 (16:34 -0700)
commit7a21d2810154c0304f1b8d71cb990602a1b1e39f
tree802b94cedec2570945e323e4f2de4ba8fc8cb2b1
parent9ed80cb761b44bf23b1c865d8d727253eab48485
eCryptfs: Properly check for O_RDONLY flag before doing privileged open

If the first attempt at opening the lower file read/write fails,
eCryptfs will retry using a privileged kthread. However, the privileged
retry should not happen if the lower file's inode is read-only because a
read/write open will still be unsuccessful.

The check for determining if the open should be retried was intended to
be based on the access mode of the lower file's open flags being
O_RDONLY, but the check was incorrectly performed. This would cause the
open to be retried by the privileged kthread, resulting in a second
failed open of the lower file. This patch corrects the check to
determine if the open request should be handled by the privileged
kthread.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
fs/ecryptfs/kthread.c