]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/ubifs/orphan.c
Merge tag 'for-linus' of git://github.com/openrisc/linux
[linux.git] / fs / ubifs / orphan.c
index 3b4b4114f208bfb6bdc1f94803e6d7b5b79bd372..54d6db61106ffc452ec08654a9e4b4a7b325745f 100644 (file)
@@ -631,12 +631,17 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
        ino_t inum;
        int i, n, err, first = 1;
 
+       ino = kmalloc(UBIFS_MAX_INO_NODE_SZ, GFP_NOFS);
+       if (!ino)
+               return -ENOMEM;
+
        list_for_each_entry(snod, &sleb->nodes, list) {
                if (snod->type != UBIFS_ORPH_NODE) {
                        ubifs_err(c, "invalid node type %d in orphan area at %d:%d",
                                  snod->type, sleb->lnum, snod->offs);
                        ubifs_dump_node(c, snod->node);
-                       return -EINVAL;
+                       err = -EINVAL;
+                       goto out_free;
                }
 
                orph = snod->node;
@@ -663,20 +668,18 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
                                ubifs_err(c, "out of order commit number %llu in orphan node at %d:%d",
                                          cmt_no, sleb->lnum, snod->offs);
                                ubifs_dump_node(c, snod->node);
-                               return -EINVAL;
+                               err = -EINVAL;
+                               goto out_free;
                        }
                        dbg_rcvry("out of date LEB %d", sleb->lnum);
                        *outofdate = 1;
-                       return 0;
+                       err = 0;
+                       goto out_free;
                }
 
                if (first)
                        first = 0;
 
-               ino = kmalloc(UBIFS_MAX_INO_NODE_SZ, GFP_NOFS);
-               if (!ino)
-                       return -ENOMEM;
-
                n = (le32_to_cpu(orph->ch.len) - UBIFS_ORPH_NODE_SZ) >> 3;
                for (i = 0; i < n; i++) {
                        union ubifs_key key1, key2;