Skip to content

Commit

Permalink
IMA: open new file for read
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mimi Zohar authored and James Morris committed Sep 3, 2009
1 parent ee18d64 commit 6c1488f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/*
Expand Down

0 comments on commit 6c1488f

Please sign in to comment.