yaffs: Discard partially written summary data
authorCharles Manning <cdhmanning@gmail.com>
Sun, 3 Apr 2011 19:57:39 +0000 (07:57 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Thu, 28 Apr 2011 04:07:41 +0000 (16:07 +1200)
A power failure during the write of a multi-chunk summary can leave stuff
lying around that  looks like part of a file. If this is detected then delete it.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
yaffs_yaffs2.c

index 093e485ac2d064318db67b60b1eb5b508e90b555..5761e960e646c816c0628a2c7b64470bb55c04f1 100644 (file)
@@ -1023,6 +1023,7 @@ static inline int yaffs2_scan_chunk(struct yaffs_dev *dev,
                        dev->n_free_chunks++;
        } else if (tags.obj_id > YAFFS_MAX_OBJECT_ID ||
                   tags.chunk_id > YAFFS_MAX_CHUNK_ID ||
+                  tags.obj_id == YAFFS_OBJECTID_SUMMARY ||
                   (tags.chunk_id > 0 &&
                     tags.n_bytes > dev->data_bytes_per_chunk) ||
                   tags.seq_number != bi->seq_number) {