1
From: John Johansen <jjohansen@suse.de>
2
Subject: Call lsm hook before unhashing dentry in vfs_rmdir()
4
If we unhash the dentry before calling the security_inode_rmdir hook,
5
we cannot compute the file's pathname in the hook anymore. AppArmor
6
needs to know the filename in order to decide whether a file may be
9
Signed-off-by: John Johansen <jjohansen@suse.de>
10
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
13
fs/namei.c | 13 +++++++------
14
1 file changed, 7 insertions(+), 6 deletions(-)
18
@@ -2097,6 +2097,10 @@ int vfs_rmdir(struct inode *dir, struct
19
if (!dir->i_op || !dir->i_op->rmdir)
22
+ error = security_inode_rmdir(dir, dentry, mnt);
28
mutex_lock(&dentry->d_inode->i_mutex);
29
@@ -2104,12 +2108,9 @@ int vfs_rmdir(struct inode *dir, struct
30
if (d_mountpoint(dentry))
33
- error = security_inode_rmdir(dir, dentry, mnt);
35
- error = dir->i_op->rmdir(dir, dentry);
37
- dentry->d_inode->i_flags |= S_DEAD;
39
+ error = dir->i_op->rmdir(dir, dentry);
41
+ dentry->d_inode->i_flags |= S_DEAD;
43
mutex_unlock(&dentry->d_inode->i_mutex);