apparmor/kernel-patches/for-mainline/file_permission-nameidata.diff
2008-07-02 20:24:33 +00:00

30 lines
779 B
Diff

From: Andreas Gruenbacher <agruen@suse.de>
Subject: Fix file_permission()
We cannot easily switch from file_permission() to vfs_permission()
everywhere, so fix file_permission() to not use a NULL nameidata
for the remaining users.
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: John Johansen <jjohansen@suse.de>
---
fs/namei.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -318,7 +318,12 @@ int vfs_permission(struct nameidata *nd,
*/
int file_permission(struct file *file, int mask)
{
- return permission(file->f_path.dentry->d_inode, mask, NULL);
+ struct nameidata nd;
+
+ nd.path = file->f_path;
+ nd.flags = LOOKUP_ACCESS;
+
+ return permission(nd.path.dentry->d_inode, mask, &nd);
}
/*