diff options
author | Brian Behlendorf <[email protected]> | 2013-02-11 12:55:24 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-02-12 10:27:39 -0800 |
commit | 9878a89d7ab05ffcdcdbf80233d02e30eea511be (patch) | |
tree | 011af26f4a5f24772eb61bde9fe274c9f85495cf | |
parent | 52768784e66a7b3ca493d907e86ee674ca50193c (diff) |
Add explicit MAXNAMELEN check
It turns out that the Linux VFS doesn't strictly handle all cases
where a component path name exceeds MAXNAMELEN. It does however
appear to correctly handle MAXPATHLEN for us.
The right way to handle this appears to be to add an explicit
check to the zpl_lookup() function. Several in-tree filesystems
handle this case the same way.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #1279
-rw-r--r-- | module/zfs/zpl_inode.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c index e40628878..8c8ec2414 100644 --- a/module/zfs/zpl_inode.c +++ b/module/zfs/zpl_inode.c @@ -41,6 +41,9 @@ zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) struct inode *ip; int error; + if (dlen(dentry) > ZFS_MAXNAMELEN) + return ERR_PTR(-ENAMETOOLONG); + crhold(cr); error = -zfs_lookup(dir, dname(dentry), &ip, 0, cr, NULL, NULL); ASSERT3S(error, <=, 0); |