diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2009-12-16 03:27:20 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-18 13:31:03 -0800 |
commit | 78ba3f31ee0e1adaa141ab4cafac9df53c6c020a (patch) | |
tree | 3c5e65429e6db68d0a32e497df5c1d8a1996f647 | |
parent | 196dc9ece8c31f9b876f33f2ac3b4597fd08930e (diff) | |
download | lwn-78ba3f31ee0e1adaa141ab4cafac9df53c6c020a.tar.gz lwn-78ba3f31ee0e1adaa141ab4cafac9df53c6c020a.zip |
jffs2: Fix long-standing bug with symlink garbage collection.
commit 2e16cfca6e17ae37ae21feca080a6f2eca9087dc upstream.
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.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | 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 090c556ffed2..3b6f2fa12cff 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; |