Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 9383e745e23602bc45f9c92184feea59 > files > 25

gfs2-utils-0.1.62-28.el5.src.rpm

commit c952ad46246b8619b723852ab967a69f2bb80290
Author: Bob Peterson <bob@ganesha.peterson>
Date:   Thu Jan 21 17:22:55 2010 -0600

    libgfs2: dir_split_leaf needs to check for allocation failure
    
    When splitting directory leaf blocks, if an allocation fails
    for some reason (e.g. corruption) it should throw an error
    rather than plowing forward.
    
    rhbz#455300

diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index f670aa5..c36b0f3 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -896,7 +896,8 @@ static void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex,
 		    be32_to_cpu(dent->de_hash) < divider) {
 			name_len = be16_to_cpu(dent->de_name_len);
 
-			dirent_alloc(dip, nbh, name_len, &new);
+			if (dirent_alloc(dip, nbh, name_len, &new))
+				die("dir_split_leaf (3)\n");
 
 			new->de_inum = dent->de_inum;
 			new->de_hash = dent->de_hash;
@@ -922,7 +923,8 @@ static void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex,
 	} while (dent);
 
 	if (!moved) {
-		dirent_alloc(dip, nbh, 0, &new);
+		if (dirent_alloc(dip, nbh, 0, &new))
+			die("dir_split_leaf (4)\n");
 		new->de_inum.no_formal_ino = 0;
 	}
 
@@ -1098,7 +1100,8 @@ restart:
 				nleaf->lf_depth = leaf->lf_depth;
 				nleaf->lf_dirent_format = cpu_to_be32(GFS2_FORMAT_DE);
 
-				dirent_alloc(dip, nbh, len, &dent);
+				if (dirent_alloc(dip, nbh, len, &dent))
+					die("dir_split_leaf (3)\n");
 				dip->i_di.di_blocks++;
 				bmodified(dip->i_bh);
 				bmodified(bh);