Skip to content

Commit

Permalink
ext[34]: fix double put in tmpfile
Browse files Browse the repository at this point in the history
d_tmpfile() already swallowed the inode ref.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Miklos Szeredi authored and Al Viro committed Oct 15, 2013
1 parent 7dee8df commit 43ae9e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions fs/ext3/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1783,18 +1783,17 @@ static int ext3_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
d_tmpfile(dentry, inode);
err = ext3_orphan_add(handle, inode);
if (err)
goto err_drop_inode;
goto err_unlock_inode;
mark_inode_dirty(inode);
unlock_new_inode(inode);
}
ext3_journal_stop(handle);
if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
goto retry;
return err;
err_drop_inode:
err_unlock_inode:
ext3_journal_stop(handle);
unlock_new_inode(inode);
iput(inode);
return err;
}

Expand Down
5 changes: 2 additions & 3 deletions fs/ext4/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -2319,7 +2319,7 @@ static int ext4_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
d_tmpfile(dentry, inode);
err = ext4_orphan_add(handle, inode);
if (err)
goto err_drop_inode;
goto err_unlock_inode;
mark_inode_dirty(inode);
unlock_new_inode(inode);
}
Expand All @@ -2328,10 +2328,9 @@ static int ext4_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries))
goto retry;
return err;
err_drop_inode:
err_unlock_inode:
ext4_journal_stop(handle);
unlock_new_inode(inode);
iput(inode);
return err;
}

Expand Down

0 comments on commit 43ae9e3

Please sign in to comment.