From: Charles Manning Date: Sun, 3 Apr 2011 19:57:39 +0000 (+1200) Subject: yaffs: Discard partially written summary data X-Git-Tag: pre-driver-refactoring~41^2~10^2~2 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=8670595b355e66200c97aa1668af04d4eaebaa6b;hp=1c179647cc26bcc05144dab770f4576979ad7152 yaffs: Discard partially written summary data 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 --- diff --git a/yaffs_yaffs2.c b/yaffs_yaffs2.c index 093e485..5761e96 100644 --- a/yaffs_yaffs2.c +++ b/yaffs_yaffs2.c @@ -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) {