Skip to content

Commit

Permalink
jffs2: Fix long-standing bug with symlink garbage collection.
Browse files Browse the repository at this point in the history
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@kernel.org
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Dec 16, 2009
1 parent 0a032a4 commit 2e16cfc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/jffs2/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 2e16cfc

Please sign in to comment.