]> git.hungrycats.org Git - linux/commitdiff
[PATCH] tmpfs 1/7 LTP ENAMETOOLONG fix
authorAndrew Morton <akpm@osdl.org>
Wed, 22 Oct 2003 01:19:49 +0000 (18:19 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 22 Oct 2003 01:19:49 +0000 (18:19 -0700)
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.

fs/libfs.c

index ab6fd98365e9bbdc6234101d30421dd904ee5843..bf7229c96fc9393e4b7bee6e63573d15624be9fa 100644 (file)
@@ -32,6 +32,8 @@ int simple_statfs(struct super_block *sb, struct kstatfs *buf)
 
 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;
 }