~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/fix-vfs_rmdir.diff

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-04-27 10:38:07 UTC
  • mfrom: (5.1.118 natty)
  • Revision ID: james.westby@ubuntu.com-20110427103807-ym3rhwys6o84ith0
Tags: 2.6.1-2
debian/copyright: clarify for some full organization names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
vfs_rmdir: call lsm hook before unhashing dentry
2
 
 
3
 
If we unhash the dentry before calling the security_inode_rmdir hook,
4
 
we cannot compute the file's pathname in the hook anymore.
5
 
 
6
 
Signed-off-by: John Johansen <jjohansen@suse.de>
7
 
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
8
 
 
9
 
Index: b/fs/namei.c
10
 
===================================================================
11
 
--- a/fs/namei.c
12
 
+++ b/fs/namei.c
13
 
@@ -2016,6 +2016,10 @@ int vfs_rmdir(struct inode *dir, struct 
14
 
        if (!dir->i_op || !dir->i_op->rmdir)
15
 
                return -EPERM;
16
 
 
17
 
+       error = security_inode_rmdir(dir, dentry, mnt);
18
 
+       if (error)
19
 
+               return error;
20
 
+
21
 
        DQUOT_INIT(dir);
22
 
 
23
 
        mutex_lock(&dentry->d_inode->i_mutex);
24
 
@@ -2023,12 +2027,9 @@ int vfs_rmdir(struct inode *dir, struct 
25
 
        if (d_mountpoint(dentry))
26
 
                error = -EBUSY;
27
 
        else {
28
 
-               error = security_inode_rmdir(dir, dentry, mnt);
29
 
-               if (!error) {
30
 
-                       error = dir->i_op->rmdir(dir, dentry);
31
 
-                       if (!error)
32
 
-                               dentry->d_inode->i_flags |= S_DEAD;
33
 
-               }
34
 
+               error = dir->i_op->rmdir(dir, dentry);
35
 
+               if (!error)
36
 
+                       dentry->d_inode->i_flags |= S_DEAD;
37
 
        }
38
 
        mutex_unlock(&dentry->d_inode->i_mutex);
39
 
        if (!error) {