summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMimi Zohar <zohar@linux.vnet.ibm.com>2009-09-02 11:40:32 -0400
committerJames Morris <jmorris@namei.org>2009-09-03 12:06:12 +1000
commit6c1488fd581a447ec87c4b59f0d33f95f0aa441b (patch)
treeae7229de1dc5582413e76f45ffdc04ae941e1daa /fs
parentee18d64c1f632043a02e6f5ba5e045bb26a5465f (diff)
downloadlinux-6c1488fd581a447ec87c4b59f0d33f95f0aa441b.tar.bz2
IMA: open new file for read
When creating a new file, ima_path_check() assumed the new file was being opened for write. Call ima_path_check() with the appropriate acc_mode so that the read/write counters are incremented correctly. Signed-off-by: Mimi Zohar <zohar@us.ibm.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c
index f3c5b278895a..ee01308a01d1 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1533,9 +1533,11 @@ int may_open(struct path *path, int acc_mode, int flag)
if (error)
return error;
- error = ima_path_check(path,
- acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC),
+ error = ima_path_check(path, acc_mode ?
+ acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC) :
+ ACC_MODE(flag) & (MAY_READ | MAY_WRITE),
IMA_COUNT_UPDATE);
+
if (error)
return error;
/*