patch-2.2.2 linux/fs/autofs/root.c

Next file: linux/fs/autofs/waitq.c
Previous file: linux/fs/affs/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.1/linux/fs/autofs/root.c linux/fs/autofs/root.c
@@ -209,7 +209,7 @@
 	NULL,			/* d_compare */
 };
 
-static int autofs_root_lookup(struct inode *dir, struct dentry * dentry)
+static int autofs_root_lookup(struct inode *dir, struct dentry *dentry)
 {
 	struct autofs_sb_info *sbi;
 	int oz_mode;
@@ -220,6 +220,9 @@
 	if (!S_ISDIR(dir->i_mode))
 		return -ENOTDIR;
 
+	if (dentry->d_name.len > NAME_MAX)
+		return -ENOENT;	/* File name too long to exist */
+
 	sbi = autofs_sbi(dir->i_sb);
 
 	oz_mode = autofs_oz_mode(sbi);
@@ -280,6 +283,9 @@
 	if ( !autofs_oz_mode(sbi) )
 		return -EPERM;
 
+	if ( dentry->d_name.len > NAME_MAX )
+		return -ENAMETOOLONG;
+
 	if ( autofs_hash_lookup(dh, &dentry->d_name) )
 		return -EEXIST;
 
@@ -400,6 +406,9 @@
 
 	if ( !autofs_oz_mode(sbi) )
 		return -EPERM;
+
+	if ( dentry->d_name.len > NAME_MAX )
+		return -ENAMETOOLONG;
 
 	ent = autofs_hash_lookup(dh, &dentry->d_name);
 	if ( ent )

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)