libgfs2: Check rgd->bits before referencing it
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 libgfs2: Check rgd->bits before referencing it
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
---
gfs2/libgfs2/rgrp.c +1 -1
@@ -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)
PATCH 1/1 libgfs2: Check rgd->bits before referencing it
Quoted 20 lines · Bob Peterson
Hi,
This patch adds a check to function
gfs2_rgrp_freeto make surergd->bitsis 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 SystemsSigned-off-by Bob Peterson <[email protected]>---
gfs2/libgfs2/rgrp.c +0
-0
gfs2/libgfs2/rgrp.c void gfs2_rgrp_free(struct osi_root *rgrp_tree) · line 250
Quoted 8 lines
gfs2/libgfs2/rgrp.c +1
-1@@ -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