diff options
author | Dan Carpenter <error27@gmail.com> | 2009-02-24 12:14:48 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-16 17:32:42 -0700 |
commit | 49d5e9a1f84aae864ac49b9579efcd99ce6993f4 (patch) | |
tree | 1b1e6db918a220bd28bda6e4a7bae24721a96733 /fs | |
parent | c4925e4c65904e5c52cd3a3e5e9b1873eec340c0 (diff) |
ext4: Fix NULL dereference in ext4_ext_migrate()'s error handling
(cherry picked from commit 090542641de833c6f756895fc2f139f046e298f9)
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 <error27@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/migrate.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index f2a9cf498ec..9aa0fbee8aa 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c @@ -480,7 +480,7 @@ 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, @@ -488,8 +488,7 @@ int ext4_ext_migrate(struct inode *inode) 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)); /* @@ -617,8 +616,7 @@ err_out: ext4_journal_stop(handle); - if (tmp_inode) - iput(tmp_inode); + iput(tmp_inode); return retval; } |