Commit a9cfcd63 authored by Theodore Ts'o's avatar Theodore Ts'o

ext4: avoid trying to kfree an ERR_PTR pointer

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>
Cc: stable@vger.kernel.org
parent d4f03186
...@@ -3240,6 +3240,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -3240,6 +3240,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
&new.de, &new.inlined); &new.de, &new.inlined);
if (IS_ERR(new.bh)) { if (IS_ERR(new.bh)) {
retval = PTR_ERR(new.bh); retval = PTR_ERR(new.bh);
new.bh = NULL;
goto end_rename; goto end_rename;
} }
if (new.bh) { if (new.bh) {
...@@ -3386,6 +3387,7 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -3386,6 +3387,7 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
&new.de, &new.inlined); &new.de, &new.inlined);
if (IS_ERR(new.bh)) { if (IS_ERR(new.bh)) {
retval = PTR_ERR(new.bh); retval = PTR_ERR(new.bh);
new.bh = NULL;
goto end_rename; goto end_rename;
} }
......
...@@ -575,6 +575,7 @@ static int setup_new_flex_group_blocks(struct super_block *sb, ...@@ -575,6 +575,7 @@ static int setup_new_flex_group_blocks(struct super_block *sb,
bh = bclean(handle, sb, block); bh = bclean(handle, sb, block);
if (IS_ERR(bh)) { if (IS_ERR(bh)) {
err = PTR_ERR(bh); err = PTR_ERR(bh);
bh = NULL;
goto out; goto out;
} }
overhead = ext4_group_overhead_blocks(sb, group); overhead = ext4_group_overhead_blocks(sb, group);
...@@ -603,6 +604,7 @@ static int setup_new_flex_group_blocks(struct super_block *sb, ...@@ -603,6 +604,7 @@ static int setup_new_flex_group_blocks(struct super_block *sb,
bh = bclean(handle, sb, block); bh = bclean(handle, sb, block);
if (IS_ERR(bh)) { if (IS_ERR(bh)) {
err = PTR_ERR(bh); err = PTR_ERR(bh);
bh = NULL;
goto out; 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