summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChunwei Chen <[email protected]>2017-02-11 12:42:17 -0800
committerBrian Behlendorf <[email protected]>2017-02-11 12:42:17 -0800
commitd6df043c530e850e907a8391025c2989eb7a9949 (patch)
tree2a28683729df6acb83077dffe8464d9634200281
parentb291029e8661dfc2f03118921e854eec4e5bbb75 (diff)
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 <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Closes #5768
-rw-r--r--module/zfs/zpl_inode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c
index 9d439db74..b39a8bbe1 100644
--- a/module/zfs/zpl_inode.c
+++ b/module/zfs/zpl_inode.c
@@ -50,7 +50,7 @@ zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
int zfs_flags = 0;
zfs_sb_t *zsb = dentry->d_sb->s_fs_info;
- if (dlen(dentry) > ZFS_MAX_DATASET_NAME_LEN)
+ if (dlen(dentry) >= ZAP_MAXNAMELEN)
return (ERR_PTR(-ENAMETOOLONG));
crhold(cr);