From: Richard Purdie Date: Tue, 18 Apr 2006 01:05:46 +0000 (+0100) Subject: JFFS2: Return an error for long filenames X-Git-Tag: v2.6.18-rc1~1105^2~147 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=373d5e71833978fe3d91264d86857762bb92cfe2;p=linux-2.6 JFFS2: Return an error for long filenames Return an error if a name is too long for JFFS2 rather than corrupting data. Signed-off-by: Richard Purdie --- diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 8bc7a5018e..f92840a3a5 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c @@ -78,6 +78,9 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, D1(printk(KERN_DEBUG "jffs2_lookup()\n")); + if (target->d_name.len > JFFS2_MAX_NAME_LEN) + return ERR_PTR(-ENAMETOOLONG); + dir_f = JFFS2_INODE_INFO(dir_i); c = JFFS2_SB_INFO(dir_i->i_sb);