Skip to content

Commit

Permalink
ext4: Fix NULL dereference in ext4_ext_migrate()'s error handling
Browse files Browse the repository at this point in the history
This was found through a code checker (http://repo.or.cz/w/smatch.git/). 
It looks like you might be able to trigger the error by trying to migrate 
a readonly file system.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: "Theodore Ts'o" <[email protected]>
  • Loading branch information
error27 authored and tytso committed Feb 16, 2009
1 parent 2acf2c2 commit 0905426
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions fs/ext4/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,16 +481,15 @@ int ext4_ext_migrate(struct inode *inode)
+ 1);
if (IS_ERR(handle)) {
retval = PTR_ERR(handle);
goto err_out;
return retval;
}
tmp_inode = ext4_new_inode(handle,
inode->i_sb->s_root->d_inode,
S_IFREG);
if (IS_ERR(tmp_inode)) {
retval = -ENOMEM;
ext4_journal_stop(handle);
tmp_inode = NULL;
goto err_out;
return retval;
}
i_size_write(tmp_inode, i_size_read(inode));
/*
Expand Down Expand Up @@ -618,8 +617,7 @@ int ext4_ext_migrate(struct inode *inode)

ext4_journal_stop(handle);

if (tmp_inode)
iput(tmp_inode);
iput(tmp_inode);

return retval;
}

0 comments on commit 0905426

Please sign in to comment.