diff options
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/fs/inode.c b/fs/inode.c index 826fb0b9d1c3..8a47ccd9fc38 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/hash.h> | 17 | #include <linux/hash.h> |
18 | #include <linux/swap.h> | 18 | #include <linux/swap.h> |
19 | #include <linux/security.h> | 19 | #include <linux/security.h> |
20 | #include <linux/ima.h> | ||
20 | #include <linux/pagemap.h> | 21 | #include <linux/pagemap.h> |
21 | #include <linux/cdev.h> | 22 | #include <linux/cdev.h> |
22 | #include <linux/bootmem.h> | 23 | #include <linux/bootmem.h> |
@@ -147,13 +148,13 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode) | |||
147 | inode->i_cdev = NULL; | 148 | inode->i_cdev = NULL; |
148 | inode->i_rdev = 0; | 149 | inode->i_rdev = 0; |
149 | inode->dirtied_when = 0; | 150 | inode->dirtied_when = 0; |
150 | if (security_inode_alloc(inode)) { | 151 | |
151 | if (inode->i_sb->s_op->destroy_inode) | 152 | if (security_inode_alloc(inode)) |
152 | inode->i_sb->s_op->destroy_inode(inode); | 153 | goto out_free_inode; |
153 | else | 154 | |
154 | kmem_cache_free(inode_cachep, (inode)); | 155 | /* allocate and initialize an i_integrity */ |
155 | return NULL; | 156 | if (ima_inode_alloc(inode)) |
156 | } | 157 | goto out_free_security; |
157 | 158 | ||
158 | spin_lock_init(&inode->i_lock); | 159 | spin_lock_init(&inode->i_lock); |
159 | lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key); | 160 | lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key); |
@@ -189,6 +190,15 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode) | |||
189 | inode->i_mapping = mapping; | 190 | inode->i_mapping = mapping; |
190 | 191 | ||
191 | return inode; | 192 | return inode; |
193 | |||
194 | out_free_security: | ||
195 | security_inode_free(inode); | ||
196 | out_free_inode: | ||
197 | if (inode->i_sb->s_op->destroy_inode) | ||
198 | inode->i_sb->s_op->destroy_inode(inode); | ||
199 | else | ||
200 | kmem_cache_free(inode_cachep, (inode)); | ||
201 | return NULL; | ||
192 | } | 202 | } |
193 | EXPORT_SYMBOL(inode_init_always); | 203 | EXPORT_SYMBOL(inode_init_always); |
194 | 204 | ||