aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 89a612e392eb..7720fbd5277b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -536,8 +536,8 @@ static int unlazy_walk(struct nameidata *nd, struct dentry *dentry)
536 * a reference at this point. 536 * a reference at this point.
537 */ 537 */
538 BUG_ON(!IS_ROOT(dentry) && dentry->d_parent != parent); 538 BUG_ON(!IS_ROOT(dentry) && dentry->d_parent != parent);
539 BUG_ON(!parent->d_count); 539 BUG_ON(!parent->d_lockref.count);
540 parent->d_count++; 540 parent->d_lockref.count++;
541 spin_unlock(&dentry->d_lock); 541 spin_unlock(&dentry->d_lock);
542 } 542 }
543 spin_unlock(&parent->d_lock); 543 spin_unlock(&parent->d_lock);
@@ -3327,7 +3327,7 @@ void dentry_unhash(struct dentry *dentry)
3327{ 3327{
3328 shrink_dcache_parent(dentry); 3328 shrink_dcache_parent(dentry);
3329 spin_lock(&dentry->d_lock); 3329 spin_lock(&dentry->d_lock);
3330 if (dentry->d_count == 1) 3330 if (dentry->d_lockref.count == 1)
3331 __d_drop(dentry); 3331 __d_drop(dentry);
3332 spin_unlock(&dentry->d_lock); 3332 spin_unlock(&dentry->d_lock);
3333} 3333}
@@ -3671,11 +3671,15 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
3671 if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) 3671 if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0)
3672 return -EINVAL; 3672 return -EINVAL;
3673 /* 3673 /*
3674 * Using empty names is equivalent to using AT_SYMLINK_FOLLOW 3674 * To use null names we require CAP_DAC_READ_SEARCH
3675 * on /proc/self/fd/<fd>. 3675 * This ensures that not everyone will be able to create
3676 * handlink using the passed filedescriptor.
3676 */ 3677 */
3677 if (flags & AT_EMPTY_PATH) 3678 if (flags & AT_EMPTY_PATH) {
3679 if (!capable(CAP_DAC_READ_SEARCH))
3680 return -ENOENT;
3678 how = LOOKUP_EMPTY; 3681 how = LOOKUP_EMPTY;
3682 }
3679 3683
3680 if (flags & AT_SYMLINK_FOLLOW) 3684 if (flags & AT_SYMLINK_FOLLOW)
3681 how |= LOOKUP_FOLLOW; 3685 how |= LOOKUP_FOLLOW;