This patch adds a check to function gfs2_rgrp_free to make sure
rgd->bits is non-zero before attempting to reference it.
This might be NULL because no buffers actually existed because
it was concocted in an attempt to repair damaged rgrps in fsck.
rhbz#1257625
---
gfs2/libgfs2/rgrp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index cf4385a..2a55523 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -244,7 +244,7 @@ void gfs2_rgrp_free(struct osi_root *rgrp_tree)
while ((n = osi_first(rgrp_tree))) {
rgd = (struct rgrp_tree *)n;
- if (rgd->bits[0].bi_bh) { /* if a buffer exists */
+ if (rgd->bits && rgd->bits[0].bi_bh) { /* if a buffer exists */
rgs_since_sync++;
if (rgs_since_sync >= RG_SYNC_TOLERANCE) {
if (!sdp)
--
2.4.3