2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-05 16:55:32 +00:00
Files
apparmor/kernel-patches/for-mainline/file_permission-nameidata.diff

30 lines
739 B
Diff
Raw Normal View History

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>
---
fs/namei.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/fs/namei.c
+++ b/fs/namei.c
2007-04-26 15:42:11 +00:00
@@ -297,7 +297,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);
2007-04-26 15:42:11 +00:00
+ struct nameidata nd = {
+ .dentry = file->f_path.dentry,
+ .mnt = file->f_path.mnt,
+ };
+
+ return permission(nd.dentry->d_inode, mask, &nd);
}
/*