From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Price Date: Wed, 16 Sep 2015 11:47:18 +0100 Subject: [Cluster-devel] [libgfs2 PATCH] libgfs2: Check rgd->bits before referencing it In-Reply-To: <1523098984.28256979.1442251211308.JavaMail.zimbra@redhat.com> References: <1523098984.28256979.1442251211308.JavaMail.zimbra@redhat.com> Message-ID: <55F948B6.40206@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On 14/09/15 18:20, Bob Peterson wrote: > 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) > ACK, Andy