提交 dc7b5fd6 编写于 作者: C Chris Sykes 提交者: Linus Torvalds

[PATCH] Fix ext3_new_inode() failure paths

Fix failure paths in ext3_new_inode() and clean up duplicated code: -
DQUOT_DROP() was not being called if ext3_init_security() failed.
Signed-off-by: NChris Sykes <chris@sigsegv.plus.com>
Cc: Stephen Smalley <sds@epoch.ncsc.mil>
Cc: Jan Kara <jack@ucw.cz>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 9ed6c2fb
...@@ -597,27 +597,22 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) ...@@ -597,27 +597,22 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
ret = inode; ret = inode;
if(DQUOT_ALLOC_INODE(inode)) { if(DQUOT_ALLOC_INODE(inode)) {
DQUOT_DROP(inode);
err = -EDQUOT; err = -EDQUOT;
goto fail2; goto fail_drop;
} }
err = ext3_init_acl(handle, inode, dir); err = ext3_init_acl(handle, inode, dir);
if (err) { if (err)
DQUOT_FREE_INODE(inode); goto fail_free_drop;
DQUOT_DROP(inode);
goto fail2;
}
err = ext3_init_security(handle,inode, dir); err = ext3_init_security(handle,inode, dir);
if (err) { if (err)
DQUOT_FREE_INODE(inode); goto fail_free_drop;
goto fail2;
}
err = ext3_mark_inode_dirty(handle, inode); err = ext3_mark_inode_dirty(handle, inode);
if (err) { if (err) {
ext3_std_error(sb, err); ext3_std_error(sb, err);
DQUOT_FREE_INODE(inode); goto fail_free_drop;
DQUOT_DROP(inode);
goto fail2;
} }
ext3_debug("allocating inode %lu\n", inode->i_ino); ext3_debug("allocating inode %lu\n", inode->i_ino);
...@@ -631,7 +626,11 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) ...@@ -631,7 +626,11 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
brelse(bitmap_bh); brelse(bitmap_bh);
return ret; return ret;
fail2: fail_free_drop:
DQUOT_FREE_INODE(inode);
fail_drop:
DQUOT_DROP(inode);
inode->i_flags |= S_NOQUOTA; inode->i_flags |= S_NOQUOTA;
inode->i_nlink = 0; inode->i_nlink = 0;
iput(inode); iput(inode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册