ret = -ENOMEM;
inode = sel_make_inode(dir->d_sb, S_IFREG | S_IRUGO | S_IWUSR);
- if (!inode)
+ if (!inode) {
+ dput(dentry);
goto out;
+ }
ret = -ENAMETOOLONG;
len = snprintf(page, PAGE_SIZE, "/%s/%s", BOOL_DIR_NAME, names[i]);
- if (len >= PAGE_SIZE)
+ if (len >= PAGE_SIZE) {
+ dput(dentry);
+ iput(inode);
goto out;
+ }
isec = (struct inode_security_struct *)inode->i_security;
ret = security_genfs_sid(fsi->state, "selinuxfs", page,
return -ENOMEM;
inode = sel_make_inode(dir->d_sb, S_IFREG|files[i].mode);
- if (!inode)
+ if (!inode) {
+ dput(dentry);
return -ENOMEM;
+ }
inode->i_fop = files[i].ops;
inode->i_ino = ++fsi->last_ino;
return -ENOMEM;
inode = sel_make_inode(dir->d_sb, S_IFREG|S_IRUGO);
- if (!inode)
+ if (!inode) {
+ dput(dentry);
return -ENOMEM;
+ }
inode->i_fop = &sel_initcon_ops;
inode->i_ino = i|SEL_INITCON_INO_OFFSET;
rc = -ENOMEM;
inode = sel_make_inode(dir->d_sb, S_IFREG|S_IRUGO);
- if (!inode)
+ if (!inode) {
+ dput(dentry);
goto out;
+ }
inode->i_fop = &sel_perm_ops;
/* i+1 since perm values are 1-indexed */
return -ENOMEM;
inode = sel_make_inode(dir->d_sb, S_IFREG|S_IRUGO);
- if (!inode)
+ if (!inode) {
+ dput(dentry);
return -ENOMEM;
+ }
inode->i_fop = &sel_class_ops;
inode->i_ino = sel_class_to_ino(index);
return -ENOMEM;
inode = sel_make_inode(fsi->sb, S_IFREG | 0444);
- if (inode == NULL)
+ if (inode == NULL) {
+ dput(dentry);
return -ENOMEM;
+ }
inode->i_fop = &sel_policycap_ops;
inode->i_ino = iter | SEL_POLICYCAP_INO_OFFSET;
ret = -ENOMEM;
inode = sel_make_inode(sb, S_IFCHR | S_IRUGO | S_IWUGO);
- if (!inode)
+ if (!inode) {
+ dput(dentry);
goto err;
+ }
inode->i_ino = ++fsi->last_ino;
isec = (struct inode_security_struct *)inode->i_security;