Fix off by one in zpl_lookup

Doing the following command would return success with zfs creating an orphan
object.

	touch $(for i in $(seq 256); do printf "n"; done)

The funny thing is that this will only work once for each directory, because
after upgraded to fzap, zfs_lookup would fail properly since it has additional
length check.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #5768
This commit is contained in:
Chunwei Chen 2017-02-11 12:42:17 -08:00 committed by Tony Hutter
parent b4c181dc76
commit 00a1a11989
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
int zfs_flags = 0; int zfs_flags = 0;
zfs_sb_t *zsb = dentry->d_sb->s_fs_info; zfs_sb_t *zsb = dentry->d_sb->s_fs_info;
if (dlen(dentry) > ZFS_MAXNAMELEN) if (dlen(dentry) >= ZAP_MAXNAMELEN)
return (ERR_PTR(-ENAMETOOLONG)); return (ERR_PTR(-ENAMETOOLONG));
crhold(cr); crhold(cr);