summaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2015-02-17 03:04:41 +0100
committerBrian Norris <computersforpeace@gmail.com>2015-02-17 03:05:26 +0100
commiteb928d40a93f73dd5bdad62c2d363df296ff94ea (patch)
tree19432163d712fa99bb35bffc8a7562e53c8a1e18 /fs/jffs2
parentmtd: hisilicon: && vs & typo (diff)
parentjffs2: fix handling of corrupted summary length (diff)
downloadlinux-eb928d40a93f73dd5bdad62c2d363df296ff94ea.tar.xz
linux-eb928d40a93f73dd5bdad62c2d363df296ff94ea.zip
Merge JFFS2 updates from David Woodhouse
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/scan.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 7654e87b0428..9ad5ba4b299b 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -510,6 +510,10 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
sumlen = c->sector_size - je32_to_cpu(sm->offset);
sumptr = buf + buf_size - sumlen;
+ /* sm->offset maybe wrong but MAGIC maybe right */
+ if (sumlen > c->sector_size)
+ goto full_scan;
+
/* Now, make sure the summary itself is available */
if (sumlen > buf_size) {
/* Need to kmalloc for this. */
@@ -544,6 +548,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
}
}
+full_scan:
buf_ofs = jeb->offset;
if (!buf_size) {