diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-03-09 11:44:00 +0000 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2007-03-09 11:44:00 +0000 |
commit | c7258a4477b5ed0243c28ec107b98bb946757448 (patch) | |
tree | c1b3bce6ea3567ac7e23241ec13a2c4a40972b0f /fs/jffs2/scan.c | |
parent | 470bc844361b238bcbe6a07ba47d51fca25f2742 (diff) | |
download | linux-c7258a4477b5ed0243c28ec107b98bb946757448.tar.bz2 |
[JFFS2] Check for all-zero node headers
Due to a poor choice of CRC32 seed, a node header which is all zeroes
would pass the CRC32 check. Explicitly check for this case, and treat it
as we do a CRC failure.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/scan.c')
-rw-r--r-- | fs/jffs2/scan.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 31c1475d922a..7fb45bd4915c 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c @@ -734,6 +734,15 @@ scan_more: ofs += 4; continue; } + /* Due to poor choice of crc32 seed, an all-zero node will have a correct CRC */ + if (!je32_to_cpu(node->hdr_crc) && !je16_to_cpu(node->nodetype) && + !je16_to_cpu(node->magic) && !je32_to_cpu(node->totlen)) { + noisy_printk(&noise, "jffs2_scan_eraseblock(): All zero node header at 0x%08x.\n", ofs); + if ((err = jffs2_scan_dirty_space(c, jeb, 4))) + return err; + ofs += 4; + continue; + } if (ofs + je32_to_cpu(node->totlen) > jeb->offset + c->sector_size) { |