[Cluster-devel] cluster/gfs2/fsck metawalk.c

rpeterso at sourceware.org rpeterso at sourceware.org
Tue Jan 23 19:44:13 UTC 2007


CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rpeterso at sourceware.org	2007-01-23 19:44:12

Modified files:
	gfs2/fsck      : metawalk.c 

Log message:
	Resolves: bz 223843 GFS2: gfs2_fsck segfaulting on corrupt extended
	attributes

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/metawalk.c.diff?cvsroot=cluster&r1=1.6&r2=1.7

--- cluster/gfs2/fsck/metawalk.c	2006/11/20 15:35:12	1.6
+++ cluster/gfs2/fsck/metawalk.c	2007/01/23 19:44:12	1.7
@@ -247,6 +247,7 @@
 	uint64_t *ea_data_ptr = NULL;
 	int i;
 	int error = 0;
+	uint32_t offset = (uint32_t)sizeof(struct gfs2_meta_header);
 
 	if(!pass->check_eattr_entry) {
 		return 0;
@@ -287,11 +288,11 @@
 				}
 			}
 		}
-		if(ea_hdr->ea_flags & GFS2_EAFLAG_LAST){
-			/* FIXME: better equal the end of the block */
+		offset += be32_to_cpu(ea_hdr->ea_rec_len);
+		if(ea_hdr->ea_flags & GFS2_EAFLAG_LAST ||
+		   offset >= ip->i_sbd->sd_sb.sb_bsize || ea_hdr->ea_rec_len == 0){
 			break;
 		}
-		/* FIXME: be sure this doesn't go beyond the end */
 		ea_hdr_prev = ea_hdr;
 		ea_hdr = (struct gfs2_ea_header *)
 			((char *)(ea_hdr) +




More information about the Cluster-devel mailing list