aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
Diffstat (limited to 'security')
-rw-r--r--security/selinux/selinuxfs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index e24235c59ddf..1a786db50bd9 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -100,8 +100,11 @@ enum sel_inos {
100 SEL_MEMBER, /* compute polyinstantiation membership decision */ 100 SEL_MEMBER, /* compute polyinstantiation membership decision */
101 SEL_CHECKREQPROT, /* check requested protection, not kernel-applied one */ 101 SEL_CHECKREQPROT, /* check requested protection, not kernel-applied one */
102 SEL_COMPAT_NET, /* whether to use old compat network packet controls */ 102 SEL_COMPAT_NET, /* whether to use old compat network packet controls */
103 SEL_INO_NEXT, /* The next inode number to use */
103}; 104};
104 105
106static unsigned long sel_last_ino = SEL_INO_NEXT - 1;
107
105#define SEL_INITCON_INO_OFFSET 0x01000000 108#define SEL_INITCON_INO_OFFSET 0x01000000
106#define SEL_INO_MASK 0x00ffffff 109#define SEL_INO_MASK 0x00ffffff
107 110
@@ -1237,6 +1240,7 @@ static int sel_make_avc_files(struct dentry *dir)
1237 goto out; 1240 goto out;
1238 } 1241 }
1239 inode->i_fop = files[i].ops; 1242 inode->i_fop = files[i].ops;
1243 inode->i_ino = ++sel_last_ino;
1240 d_add(dentry, inode); 1244 d_add(dentry, inode);
1241 } 1245 }
1242out: 1246out:
@@ -1304,6 +1308,7 @@ static int sel_make_dir(struct inode *dir, struct dentry *dentry)
1304 } 1308 }
1305 inode->i_op = &simple_dir_inode_operations; 1309 inode->i_op = &simple_dir_inode_operations;
1306 inode->i_fop = &simple_dir_operations; 1310 inode->i_fop = &simple_dir_operations;
1311 inode->i_ino = ++sel_last_ino;
1307 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 1312 /* directory inodes start off with i_nlink == 2 (for "." entry) */
1308 inc_nlink(inode); 1313 inc_nlink(inode);
1309 d_add(dentry, inode); 1314 d_add(dentry, inode);
@@ -1366,6 +1371,7 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent)
1366 ret = -ENOMEM; 1371 ret = -ENOMEM;
1367 goto err; 1372 goto err;
1368 } 1373 }
1374 inode->i_ino = ++sel_last_ino;
1369 isec = (struct inode_security_struct*)inode->i_security; 1375 isec = (struct inode_security_struct*)inode->i_security;
1370 isec->sid = SECINITSID_DEVNULL; 1376 isec->sid = SECINITSID_DEVNULL;
1371 isec->sclass = SECCLASS_CHR_FILE; 1377 isec->sclass = SECCLASS_CHR_FILE;