Commit 01d02814 authored by David Woodhouse's avatar David Woodhouse

Prevent crash after mounting JFFS2 images built with incorrect erase size.

parent 1390bfa0
......@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
* $Id: scan.c,v 1.78 2002/07/02 22:48:24 dwmw2 Exp $
* $Id: scan.c,v 1.79 2002/07/25 20:48:51 dwmw2 Exp $
*
*/
#include <linux/kernel.h>
......@@ -322,6 +322,16 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
continue;
}
if (ofs + node.totlen > jeb->offset + c->sector_size) {
/* Eep. Node goes over the end of the erase block. */
printk(KERN_WARNING "Node at 0x%08x with length 0x%08x would run over the end of the erase block\n",
ofs, node.totlen);
printk(KERN_WARNING "Perhaps the file system was created with the wrong erase size?\n");
DIRTY_SPACE(4);
ofs += 4;
continue;
}
if (!(node.nodetype & JFFS2_NODE_ACCURATE)) {
/* Wheee. This is an obsoleted node */
D2(printk(KERN_DEBUG "Node at 0x%08x is obsolete. Skipping\n", ofs));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment