diff options
Diffstat (limited to 'security')
-rw-r--r-- | security/selinux/selinuxfs.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index f898080b9493..1bfb40701b5a 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
@@ -1213,28 +1213,34 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent) | |||
1213 | }; | 1213 | }; |
1214 | ret = simple_fill_super(sb, SELINUX_MAGIC, selinux_files); | 1214 | ret = simple_fill_super(sb, SELINUX_MAGIC, selinux_files); |
1215 | if (ret) | 1215 | if (ret) |
1216 | return ret; | 1216 | goto err; |
1217 | 1217 | ||
1218 | dentry = d_alloc_name(sb->s_root, BOOL_DIR_NAME); | 1218 | dentry = d_alloc_name(sb->s_root, BOOL_DIR_NAME); |
1219 | if (!dentry) | 1219 | if (!dentry) { |
1220 | return -ENOMEM; | 1220 | ret = -ENOMEM; |
1221 | goto err; | ||
1222 | } | ||
1221 | 1223 | ||
1222 | ret = sel_make_dir(sb, dentry); | 1224 | ret = sel_make_dir(sb, dentry); |
1223 | if (ret) | 1225 | if (ret) |
1224 | return ret; | 1226 | goto err; |
1225 | 1227 | ||
1226 | bool_dir = dentry; | 1228 | bool_dir = dentry; |
1227 | ret = sel_make_bools(); | 1229 | ret = sel_make_bools(); |
1228 | if (ret) | 1230 | if (ret) |
1229 | goto out; | 1231 | goto err; |
1230 | 1232 | ||
1231 | dentry = d_alloc_name(sb->s_root, NULL_FILE_NAME); | 1233 | dentry = d_alloc_name(sb->s_root, NULL_FILE_NAME); |
1232 | if (!dentry) | 1234 | if (!dentry) { |
1233 | return -ENOMEM; | 1235 | ret = -ENOMEM; |
1236 | goto err; | ||
1237 | } | ||
1234 | 1238 | ||
1235 | inode = sel_make_inode(sb, S_IFCHR | S_IRUGO | S_IWUGO); | 1239 | inode = sel_make_inode(sb, S_IFCHR | S_IRUGO | S_IWUGO); |
1236 | if (!inode) | 1240 | if (!inode) { |
1237 | goto out; | 1241 | ret = -ENOMEM; |
1242 | goto err; | ||
1243 | } | ||
1238 | isec = (struct inode_security_struct*)inode->i_security; | 1244 | isec = (struct inode_security_struct*)inode->i_security; |
1239 | isec->sid = SECINITSID_DEVNULL; | 1245 | isec->sid = SECINITSID_DEVNULL; |
1240 | isec->sclass = SECCLASS_CHR_FILE; | 1246 | isec->sclass = SECCLASS_CHR_FILE; |
@@ -1245,22 +1251,23 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent) | |||
1245 | selinux_null = dentry; | 1251 | selinux_null = dentry; |
1246 | 1252 | ||
1247 | dentry = d_alloc_name(sb->s_root, "avc"); | 1253 | dentry = d_alloc_name(sb->s_root, "avc"); |
1248 | if (!dentry) | 1254 | if (!dentry) { |
1249 | return -ENOMEM; | 1255 | ret = -ENOMEM; |
1256 | goto err; | ||
1257 | } | ||
1250 | 1258 | ||
1251 | ret = sel_make_dir(sb, dentry); | 1259 | ret = sel_make_dir(sb, dentry); |
1252 | if (ret) | 1260 | if (ret) |
1253 | goto out; | 1261 | goto err; |
1254 | 1262 | ||
1255 | ret = sel_make_avc_files(dentry); | 1263 | ret = sel_make_avc_files(dentry); |
1256 | if (ret) | 1264 | if (ret) |
1257 | goto out; | 1265 | goto err; |
1258 | |||
1259 | return 0; | ||
1260 | out: | 1266 | out: |
1261 | dput(dentry); | 1267 | return ret; |
1268 | err: | ||
1262 | printk(KERN_ERR "%s: failed while creating inodes\n", __FUNCTION__); | 1269 | printk(KERN_ERR "%s: failed while creating inodes\n", __FUNCTION__); |
1263 | return -ENOMEM; | 1270 | goto out; |
1264 | } | 1271 | } |
1265 | 1272 | ||
1266 | static struct super_block *sel_get_sb(struct file_system_type *fs_type, | 1273 | static struct super_block *sel_get_sb(struct file_system_type *fs_type, |