LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File gfs2_edit_fix_segfault_in_set_bitmap_when_block_is_rgrp.patch of Package cluster (Project home:sschapiro:openstack:upstream)

commit 5cb72e7ab6105f78af396a7e68d19ddaf3d06289
Author: Bob Peterson <rpeterso@redhat.com>
Date:   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

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);