From 6aaf15960b50fd276ac53dd64651dd00dc5f3f81 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 30 Nov 2009 09:06:40 +0000 Subject: [PATCH] --- yaml --- r: 168851 b: refs/heads/master c: 199bc9ff5ca5e4b3bcaff8927b2983c65f34c263 h: refs/heads/master i: 168849: a9c9da4186ebf18b4c2562ddf45cb21601a54013 168847: 81e54cbe1821404f452307a777b7d559efc9913b v: v3 --- [refs] | 2 +- trunk/fs/jffs2/read.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index ae018eb3e610..8092ea2008b5 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c69f677cc852f3f7b2342ab2f1598670a463d576 +refs/heads/master: 199bc9ff5ca5e4b3bcaff8927b2983c65f34c263 diff --git a/trunk/fs/jffs2/read.c b/trunk/fs/jffs2/read.c index cfe05c1966a5..3f39be1b0455 100644 --- a/trunk/fs/jffs2/read.c +++ b/trunk/fs/jffs2/read.c @@ -164,12 +164,15 @@ int jffs2_read_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, /* XXX FIXME: Where a single physical node actually shows up in two frags, we read it twice. Don't do that. */ - /* Now we're pointing at the first frag which overlaps our page */ + /* Now we're pointing at the first frag which overlaps our page + * (or perhaps is before it, if we've been asked to read off the + * end of the file). */ while(offset < end) { D2(printk(KERN_DEBUG "jffs2_read_inode_range: offset %d, end %d\n", offset, end)); - if (unlikely(!frag || frag->ofs > offset)) { + if (unlikely(!frag || frag->ofs > offset || + frag->ofs + frag->size <= offset)) { uint32_t holesize = end - offset; - if (frag) { + if (frag && frag->ofs > offset) { D1(printk(KERN_NOTICE "Eep. Hole in ino #%u fraglist. frag->ofs = 0x%08x, offset = 0x%08x\n", f->inocache->ino, frag->ofs, offset)); holesize = min(holesize, frag->ofs - offset); }