]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.apparmor/fix-vfs_rmdir.diff
Fix oinkmaster patch.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.apparmor / fix-vfs_rmdir.diff
CommitLineData
4d1e5b62
AF
1From: John Johansen <jjohansen@suse.de>
2Subject: Call lsm hook before unhashing dentry in vfs_rmdir()
3
4If we unhash the dentry before calling the security_inode_rmdir hook,
5we cannot compute the file's pathname in the hook anymore. AppArmor
6needs to know the filename in order to decide whether a file may be
7deleted, though.
8
9Signed-off-by: John Johansen <jjohansen@suse.de>
10Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
11
12---
13 fs/namei.c | 13 +++++++------
14 1 file changed, 7 insertions(+), 6 deletions(-)
15
16--- a/fs/namei.c
17+++ b/fs/namei.c
18@@ -2177,6 +2177,10 @@ int vfs_rmdir(struct inode *dir, struct
19 if (!dir->i_op || !dir->i_op->rmdir)
20 return -EPERM;
21
22+ error = security_inode_rmdir(dir, dentry, mnt);
23+ if (error)
24+ return error;
25+
26 DQUOT_INIT(dir);
27
28 mutex_lock(&dentry->d_inode->i_mutex);
29@@ -2184,12 +2188,9 @@ int vfs_rmdir(struct inode *dir, struct
30 if (d_mountpoint(dentry))
31 error = -EBUSY;
32 else {
33- error = security_inode_rmdir(dir, dentry, mnt);
34- if (!error) {
35- error = dir->i_op->rmdir(dir, dentry);
36- if (!error)
37- dentry->d_inode->i_flags |= S_DEAD;
38- }
39+ error = dir->i_op->rmdir(dir, dentry);
40+ if (!error)
41+ dentry->d_inode->i_flags |= S_DEAD;
42 }
43 mutex_unlock(&dentry->d_inode->i_mutex);
44 if (!error) {