aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorMimi Zohar <zohar@linux.vnet.ibm.com>2009-02-04 09:06:57 -0500
committerJames Morris <jmorris@namei.org>2009-02-05 17:05:30 -0500
commit6146f0d5e47ca4047ffded0fb79b6c25359b386c (patch)
treeedd792e52ad56d4a5d3ac6caa8437d3283fc157e /fs/namei.c
parent659aaf2bb5496a425ba14036b5b5900f593e4484 (diff)
integrity: IMA hooks
This patch replaces the generic integrity hooks, for which IMA registered itself, with IMA integrity hooks in the appropriate places directly in the fs directory. Signed-off-by: Mimi Zohar <zohar@us.ibm.com> Acked-by: Serge Hallyn <serue@us.ibm.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c
index af3783fff1de..734f2b5591bf 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -24,6 +24,7 @@
24#include <linux/fsnotify.h> 24#include <linux/fsnotify.h>
25#include <linux/personality.h> 25#include <linux/personality.h>
26#include <linux/security.h> 26#include <linux/security.h>
27#include <linux/ima.h>
27#include <linux/syscalls.h> 28#include <linux/syscalls.h>
28#include <linux/mount.h> 29#include <linux/mount.h>
29#include <linux/audit.h> 30#include <linux/audit.h>
@@ -860,6 +861,8 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
860 err = exec_permission_lite(inode); 861 err = exec_permission_lite(inode);
861 if (err == -EAGAIN) 862 if (err == -EAGAIN)
862 err = vfs_permission(nd, MAY_EXEC); 863 err = vfs_permission(nd, MAY_EXEC);
864 if (!err)
865 err = ima_path_check(&nd->path, MAY_EXEC);
863 if (err) 866 if (err)
864 break; 867 break;
865 868
@@ -1525,6 +1528,11 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
1525 error = vfs_permission(nd, acc_mode); 1528 error = vfs_permission(nd, acc_mode);
1526 if (error) 1529 if (error)
1527 return error; 1530 return error;
1531
1532 error = ima_path_check(&nd->path,
1533 acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC));
1534 if (error)
1535 return error;
1528 /* 1536 /*
1529 * An append-only file must be opened in append mode for writing. 1537 * An append-only file must be opened in append mode for writing.
1530 */ 1538 */