mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] IMA: open new file for read
@ 2009-09-02 15:40 Mimi Zohar
  2009-09-03  2:20 ` James Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Mimi Zohar @ 2009-09-02 15:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: Mimi Zohar, James Morris, David Safford, Mimi Zohar

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>
---
 fs/namei.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index f3c5b27..ee01308 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;
 	/*
-- 
1.6.0.6


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-03  2:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-02 15:40 [PATCH 1/1] IMA: open new file for read Mimi Zohar
2009-09-03  2:20 ` James Morris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®