9p: Creating files with names too long should fail with ENAMETOOLONG.
authorSripathi Kodi <sripathik@in.ibm.com>
Mon, 29 Mar 2010 23:13:59 +0000 (18:13 -0500)
committerEric Van Hensbergen <ericvh@gmail.com>
Mon, 5 Apr 2010 15:37:37 +0000 (10:37 -0500)
Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
fs/9p/vfs_inode.c

index ae8396707707f2930dde969e7ce5a0d555964be0..905f664b8bc6fddc39f91b4abf810548631ef8b2 100644 (file)
@@ -660,6 +660,9 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
        P9_DPRINTK(P9_DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n",
                dir, dentry->d_name.name, dentry, nameidata);
 
+       if (dentry->d_name.len > NAME_MAX)
+               return ERR_PTR(-ENAMETOOLONG);
+
        sb = dir->i_sb;
        v9ses = v9fs_inode2v9ses(dir);
        dfid = v9fs_fid_lookup(dentry->d_parent);