From: Hugh Dickins <hugh@veritas.com>

LTP tests the filesystem on /tmp: there are many failures when using tmpfs
because simple_lookup forgot to reject filenames longer than the NAME_MAX
tmpfs declares in its statfs.  This also fixes ramfs and hugetlbfs.



 25-akpm/fs/libfs.c |    2 ++
 1 files changed, 2 insertions(+)

diff -puN fs/libfs.c~tmpfs-01-ENAMETOOLONG fs/libfs.c
--- 25/fs/libfs.c~tmpfs-01-ENAMETOOLONG	Wed Oct 15 12:16:19 2003
+++ 25-akpm/fs/libfs.c	Wed Oct 15 12:16:19 2003
@@ -32,6 +32,8 @@ int simple_statfs(struct super_block *sb
 
 struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
 {
+	if (dentry->d_name.len > NAME_MAX)
+		return ERR_PTR(-ENAMETOOLONG);
 	d_add(dentry, NULL);
 	return NULL;
 }

_