Commit 9ed6c2fb authored by Chris Sykes's avatar Chris Sykes Committed by Linus Torvalds
Browse files

[PATCH] Fix ext2_new_inode() failure paths

Fix failure paths in ext2_new_inode() and clean up duplicated code: -
DQUOT_DROP() was not being called if ext2_init_security() failed.
Signed-off-by: default avatarChris Sykes <>
Cc: Stephen Smalley <>
Cc: Jan Kara <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent ee4e5271
...@@ -605,27 +605,28 @@ got: ...@@ -605,27 +605,28 @@ got:
insert_inode_hash(inode); insert_inode_hash(inode);
if (DQUOT_ALLOC_INODE(inode)) { if (DQUOT_ALLOC_INODE(inode)) {
err = -ENOSPC; err = -ENOSPC;
goto fail2; goto fail_drop;
} }
err = ext2_init_acl(inode, dir); err = ext2_init_acl(inode, dir);
if (err) { if (err)
DQUOT_FREE_INODE(inode); goto fail_free_drop;
goto fail2;
err = ext2_init_security(inode,dir); err = ext2_init_security(inode,dir);
if (err) { if (err)
DQUOT_FREE_INODE(inode); goto fail_free_drop;
goto fail2;
mark_inode_dirty(inode); mark_inode_dirty(inode);
ext2_debug("allocating inode %lu\n", inode->i_ino); ext2_debug("allocating inode %lu\n", inode->i_ino);
ext2_preread_inode(inode); ext2_preread_inode(inode);
return inode; return inode;
fail2: fail_free_drop:
inode->i_flags |= S_NOQUOTA; inode->i_flags |= S_NOQUOTA;
inode->i_nlink = 0; inode->i_nlink = 0;
iput(inode); iput(inode);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment