Merge tag 'gfs2-for-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2...
[linux-2.6-block.git] / fs / gfs2 / xattr.c
index 8c96ba6230d1b9ace38bc09010fd637a89c76238..17ae5070a90e67d3e8f3cb2fbdd8e6e538d1a524 100644 (file)
@@ -96,30 +96,34 @@ static int ea_foreach_i(struct gfs2_inode *ip, struct buffer_head *bh,
                return -EIO;
 
        for (ea = GFS2_EA_BH2FIRST(bh);; prev = ea, ea = GFS2_EA2NEXT(ea)) {
-               if (!GFS2_EA_REC_LEN(ea))
-                       goto fail;
+               if (!GFS2_EA_REC_LEN(ea)) {
+                       gfs2_consist_inode(ip);
+                       return -EIO;
+               }
                if (!(bh->b_data <= (char *)ea && (char *)GFS2_EA2NEXT(ea) <=
-                                                 bh->b_data + bh->b_size))
-                       goto fail;
-               if (!gfs2_eatype_valid(sdp, ea->ea_type))
-                       goto fail;
+                                                 bh->b_data + bh->b_size)) {
+                       gfs2_consist_inode(ip);
+                       return -EIO;
+               }
+               if (!gfs2_eatype_valid(sdp, ea->ea_type)) {
+                       gfs2_consist_inode(ip);
+                       return -EIO;
+               }
                error = ea_call(ip, bh, ea, prev, data);
                if (error)
                        return error;
 
                if (GFS2_EA_IS_LAST(ea)) {
                        if ((char *)GFS2_EA2NEXT(ea) !=
-                           bh->b_data + bh->b_size)
-                               goto fail;
+                           bh->b_data + bh->b_size) {
+                               gfs2_consist_inode(ip);
+                               return -EIO;
+                       }
                        break;
                }
        }
 
        return error;
-
-fail:
-       gfs2_consist_inode(ip);
-       return -EIO;
 }
 
 static int ea_foreach(struct gfs2_inode *ip, ea_call_t ea_call, void *data)