Gitweb:
http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=b6630127...
Commit: b663012772ab7d19dcb8e456e48263806e034549
Parent: a34a8c49dbc0a710ca67e83fbc00bd54db3b41c8
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Apr 3 00:35:01 2015 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Fri Apr 3 00:35:01 2015 +0100
libgfs2: Fix potential NULL deref in linked_leaf_search()
Spotted by coverity: "Null-checking "bh" suggests that it may be null,
but it has already been dereferenced on all paths leading to the check."
Also remove some dangling whitespace from that function.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/fs_ops.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index b84b7f4..2ae27d1 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -1669,22 +1669,22 @@ static int linked_leaf_search(struct gfs2_inode *dip, const char
*filename,
case 0:
*bh_out = bh;
return 0;
-
+
case -ENOENT:
break;
-
+
default:
if (bh && bh != dip->i_bh)
brelse(bh);
return error;
}
-
+
error = get_next_leaf(dip, bh, &bh_next);
- } while (!error);
-
+ } while (!error && bh_next != NULL);
+
if (bh && bh != dip->i_bh)
brelse(bh);
-
+
return error;
}