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.
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;
}