aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/gc.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-10-13 06:35:58 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-10-13 06:35:58 -0400
commitb534e70cf5529378a1ed994492641ec0330554eb (patch)
treed0257ffa39a331cad12e855122cb1e540b0eac41 /fs/jffs2/gc.c
parent69ca4378aa376cf2c49657d4f6951da56c27cd3a (diff)
[JFFS2] Handle dirents on the flash with embedded zero bytes in names.
In three places: summary scan, normal scan, REF_PRISTINE GC. Just truncate at the NUL, since that was the correct thing to do in the only case where this (inexplicable) breakage has been seen. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/gc.c')
-rw-r--r--fs/jffs2/gc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c
index 95be264fe9b6..f25e485ed879 100644
--- a/fs/jffs2/gc.c
+++ b/fs/jffs2/gc.c
@@ -608,10 +608,15 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
608 goto bail; 608 goto bail;
609 } 609 }
610 610
611 if (strnlen(node->d.name, node->d.nsize) != node->d.nsize) {
612 printk(KERN_WARNING "Name in dirent node at 0x%08x contains zeroes\n", ref_offset(raw));
613 goto bail;
614 }
615
611 if (node->d.nsize) { 616 if (node->d.nsize) {
612 crc = crc32(0, node->d.name, node->d.nsize); 617 crc = crc32(0, node->d.name, node->d.nsize);
613 if (je32_to_cpu(node->d.name_crc) != crc) { 618 if (je32_to_cpu(node->d.name_crc) != crc) {
614 printk(KERN_WARNING "Name CRC failed on REF_PRISTINE dirent ode at 0x%08x: Read 0x%08x, calculated 0x%08x\n", 619 printk(KERN_WARNING "Name CRC failed on REF_PRISTINE dirent node at 0x%08x: Read 0x%08x, calculated 0x%08x\n",
615 ref_offset(raw), je32_to_cpu(node->d.name_crc), crc); 620 ref_offset(raw), je32_to_cpu(node->d.name_crc), crc);
616 goto bail; 621 goto bail;
617 } 622 }