summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2014-09-03 09:33:00 -0400
committerZefan Li <lizefan@huawei.com>2014-12-01 18:02:41 +0800
commitefdbbff6f413513eb11aaa7bce3b289faee88f29 (patch)
tree6d43fb009b3b2e68ef2e13815478a274e0e97ff8 /fs
parentdf22b9ebd5c3b63bfb2582470b53771bf276f252 (diff)
ext4: avoid trying to kfree an ERR_PTR pointer
commit a9cfcd63e8d206ce4235c355d857c4fbdf0f4587 upstream. Thanks to Dan Carpenter for extending smatch to find bugs like this. (This was found using a development version of smatch.) Fixes: 36de928641ee48b2078d3fe9514242aaa2f92013 Reported-by: Dan Carpenter <dan.carpenter@oracle.com Signed-off-by: Theodore 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: Zefan Li <lizefan@huawei.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/namei.c1
-rw-r--r--fs/ext4/resize.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index a2efbda53fab..665e55ca208c 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -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) {
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 50992c3025c2..a43e43c835d1 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -528,6 +528,7 @@ handle_bb:
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 @@ handle_ib:
bh = bclean(handle, sb, block);
if (IS_ERR(bh)) {
err = PTR_ERR(bh);
+ bh = NULL;
goto out;
}