From 6b0064153dbd803570fd1258f411060f48f37c63 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 21 Oct 2003 18:19:49 -0700 Subject: [PATCH] [PATCH] tmpfs 1/7 LTP ENAMETOOLONG fix From: Hugh Dickins 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/libfs.c b/fs/libfs.c index ab6fd98365e9b..bf7229c96fc93 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -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; } -- 2.53.0