
#
# Patch managed by http://www.holgerschurig.de/patcher.html
#

--- linux2/fs/jffs2/dir.c~rp-jffs2-longfilename-r0.patch
+++ linux2/fs/jffs2/dir.c
@@ -88,6 +88,9 @@
 
 	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);
 
@@ -298,6 +301,9 @@
 	uint32_t alloclen, phys_ofs;
 	int ret;
 
+	if ((strlen(target)+1) > dir_i->i_sb->s_blocksize)
+		return -ENAMETOOLONG;
+
 	/* FIXME: If you care. We'd need to use frags for the target
 	   if it grows much more than this */
 	if (strlen(target) > 254)

