From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Peterson Date: Mon, 14 Sep 2015 13:20:11 -0400 (EDT) Subject: [Cluster-devel] [libgfs2 PATCH] libgfs2: Check rgd->bits before referencing it In-Reply-To: <543497282.28256766.1442251172899.JavaMail.zimbra@redhat.com> Message-ID: <1523098984.28256979.1442251211308.JavaMail.zimbra@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, 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. Regards, Bob Peterson Red Hat File Systems Signed-off-by: Bob Peterson --- 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)