jffs2: Fix long-standing bug with symlink garbage collection.

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Dec 15 23:59:01 EST 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=2e16cfca6e17ae37ae21feca080a6f2eca9087dc
Commit:     2e16cfca6e17ae37ae21feca080a6f2eca9087dc
Parent:     0a032a4df6dc4a82bcd1c401e57ee71825d30c14
Author:     David Woodhouse <David.Woodhouse at intel.com>
AuthorDate: Wed Dec 16 03:27:20 2009 +0000
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Wed Dec 16 03:27:20 2009 +0000

    jffs2: Fix long-standing bug with symlink garbage collection.
    
    Ever since jffs2_garbage_collect_metadata() was first half-written in
    February 2001, it's been broken on architectures where 'char' is signed.
    When garbage collecting a symlink with target length above 127, the payload
    length would end up negative, causing interesting and bad things to happen.
    
    Cc: stable at kernel.org
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 fs/jffs2/gc.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c
index 090c556..3b6f2fa 100644
--- a/fs/jffs2/gc.c
+++ b/fs/jffs2/gc.c
@@ -700,7 +700,8 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
 	struct jffs2_raw_inode ri;
 	struct jffs2_node_frag *last_frag;
 	union jffs2_device_node dev;
-	char *mdata = NULL, mdatalen = 0;
+	char *mdata = NULL;
+	int mdatalen = 0;
 	uint32_t alloclen, ilen;
 	int ret;
 



More information about the linux-mtd-cvs mailing list