cluster: RHEL6 - gfs2_edit: fix segfault in set_bitmap when block is in rgrp

Bob Peterson rpeterso at fedoraproject.org
Thu Feb 3 18:35:50 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=5cb72e7ab6105f78af396a7e68d19ddaf3d06289
Commit:        5cb72e7ab6105f78af396a7e68d19ddaf3d06289
Parent:        04ed614339bb64003f3cc42af9994ff637313618
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Thu Feb 3 12:18:49 2011 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Thu Feb 3 12:18:49 2011 -0600

gfs2_edit: fix segfault in set_bitmap when block is in rgrp

If you called libgfs2 function gfs2_set_bitmap to set a bit but
specified a block outside the data blocks, it would segfault.

rhbz#674843
---
 gfs2/libgfs2/fs_bits.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gfs2/libgfs2/fs_bits.c b/gfs2/libgfs2/fs_bits.c
index 7409bed..38ef92c 100644
--- a/gfs2/libgfs2/fs_bits.c
+++ b/gfs2/libgfs2/fs_bits.c
@@ -168,7 +168,7 @@ int gfs2_set_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, int state)
 
 	rgd = gfs2_blk2rgrpd(sdp, blkno);
 
-	if(!rgd)
+	if(!rgd || blkno < rgd->ri.ri_data0)
 		return -1;
 
 	rgrp_block = (uint32_t)(blkno - rgd->ri.ri_data0);


More information about the cluster-commits mailing list