Commit efdbbff6 authored by Theodore Ts'o's avatar Theodore Ts'o Committed by Zefan Li

ext4: avoid trying to kfree an ERR_PTR pointer

commit a9cfcd63 upstream.

Thanks to Dan Carpenter for extending smatch to find bugs like this.
(This was found using a development version of smatch.)

Fixes: 36de9286
Reported-by: Dan Carpenter <dan.carpenter@oracle.com
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
[lizf: Backported to 3.4:
- s/new.bh/new_bh/
- drop the change to ext4_cross_rename()]
Signed-off-by: default avatarZefan Li <lizefan@huawei.com>
parent df22b9eb
......@@ -2452,6 +2452,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
new_bh = ext4_find_entry(new_dir, &new_dentry->d_name, &new_de);
if (IS_ERR(new_bh)) {
retval = PTR_ERR(new_bh);
new_bh = NULL;
goto end_rename;
}
if (new_bh) {
......
......@@ -528,6 +528,7 @@ static int setup_new_flex_group_blocks(struct super_block *sb,
bh = bclean(handle, sb, block);
if (IS_ERR(bh)) {
err = PTR_ERR(bh);
bh = NULL;
goto out;
}
if (ext4_bg_has_super(sb, group)) {
......@@ -556,6 +557,7 @@ static int setup_new_flex_group_blocks(struct super_block *sb,
bh = bclean(handle, sb, block);
if (IS_ERR(bh)) {
err = PTR_ERR(bh);
bh = NULL;
goto out;
}
......
Markdown is supported
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