Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 226688
b: refs/heads/master
c: 786a5e1
h: refs/heads/master
v: v3
  • Loading branch information
Nick Piggin committed Jan 7, 2011
1 parent 9759ab0 commit 554fc46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d3a23e1678a5827c38ed8a465ad91d65e59fa911
refs/heads/master: 786a5e15b613a9cee4fc9139fc3113a5ab0fde79
25 changes: 7 additions & 18 deletions trunk/fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1483,41 +1483,30 @@ struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name)
}

/**
* d_validate - verify dentry provided from insecure source
* d_validate - verify dentry provided from insecure source (deprecated)
* @dentry: The dentry alleged to be valid child of @dparent
* @dparent: The parent dentry (known to be valid)
*
* An insecure source has sent us a dentry, here we verify it and dget() it.
* This is used by ncpfs in its readdir implementation.
* Zero is returned in the dentry is invalid.
*
* This function is slow for big directories, and deprecated, do not use it.
*/

int d_validate(struct dentry *dentry, struct dentry *dparent)
{
struct hlist_head *base;
struct hlist_node *lhp;

/* Check whether the ptr might be valid at all.. */
if (!kmem_ptr_validate(dentry_cache, dentry))
goto out;

if (dentry->d_parent != dparent)
goto out;
struct dentry *child;

spin_lock(&dcache_lock);
base = d_hash(dparent, dentry->d_name.hash);
hlist_for_each(lhp,base) {
/* hlist_for_each_entry_rcu() not required for d_hash list
* as it is parsed under dcache_lock
*/
if (dentry == hlist_entry(lhp, struct dentry, d_hash)) {
list_for_each_entry(child, &dparent->d_subdirs, d_u.d_child) {
if (dentry == child) {
__dget_locked(dentry);
spin_unlock(&dcache_lock);
return 1;
}
}
spin_unlock(&dcache_lock);
out:

return 0;
}
EXPORT_SYMBOL(d_validate);
Expand Down

0 comments on commit 554fc46

Please sign in to comment.