]> err.no Git - linux-2.6/commitdiff
[PATCH] selinuxfs cleanups: fix hard link count
authorJames Morris <jmorris@namei.org>
Wed, 22 Mar 2006 08:09:16 +0000 (00:09 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 22 Mar 2006 15:54:07 +0000 (07:54 -0800)
Fix the hard link count for selinuxfs directories, which are currently one
short.

Signed-off-by: James Morris <jmorris@namei.org>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
security/selinux/selinuxfs.c

index cc782083d71fd2b793b7063df6b95f8400a3b92b..4f7cda67ac0a6ee81e59c3c64df1931852162095 100644 (file)
@@ -1181,6 +1181,8 @@ static int sel_make_dir(struct super_block *sb, struct dentry *dentry)
        }
        inode->i_op = &simple_dir_inode_operations;
        inode->i_fop = &simple_dir_operations;
+       /* directory inodes start off with i_nlink == 2 (for "." entry) */
+       inode->i_nlink++;
        d_add(dentry, inode);
 out:
        return ret;
@@ -1222,6 +1224,8 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent)
                goto out;
        inode->i_op = &simple_dir_inode_operations;
        inode->i_fop = &simple_dir_operations;
+       /* directory inodes start off with i_nlink == 2 (for "." entry) */
+       inode->i_nlink++;
        d_add(dentry, inode);
        bool_dir = dentry;
        ret = sel_make_bools();