autofs4: check for invalid dentry in getpath

Catch invalid dentry when calculating its path.

Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Ian Kent 2008-05-01 04:35:07 -07:00 committed by Linus Torvalds
parent afec570c32
commit cab0936aac
1 changed files with 1 additions and 1 deletions

View File

@ -171,7 +171,7 @@ static int autofs4_getpath(struct autofs_sb_info *sbi,
for (tmp = dentry ; tmp != root ; tmp = tmp->d_parent)
len += tmp->d_name.len + 1;
if (--len > NAME_MAX) {
if (!len || --len > NAME_MAX) {
spin_unlock(&dcache_lock);
return 0;
}