Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 234260
b: refs/heads/master
c: 6a96ba5
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Mar 14, 2011
1 parent 3f2d6ae commit 7d78f80
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 27 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: fe2d35ff0d18a2c93993b0d7d46f846ff4331b72
refs/heads/master: 6a96ba54418be740303765c0f52be028573cb99a
41 changes: 15 additions & 26 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1759,28 +1759,6 @@ static struct dentry *lookup_hash(struct nameidata *nd)
return __lookup_hash(&nd->last, nd->path.dentry, nd);
}

static int __lookup_one_len(const char *name, struct qstr *this,
struct dentry *base, int len)
{
unsigned long hash;
unsigned int c;

this->name = name;
this->len = len;
if (!len)
return -EACCES;

hash = init_name_hash();
while (len--) {
c = *(const unsigned char *)name++;
if (c == '/' || c == '\0')
return -EACCES;
hash = partial_name_hash(c, hash);
}
this->hash = end_name_hash(hash);
return 0;
}

/**
* lookup_one_len - filesystem helper to lookup single pathname component
* @name: pathname component to lookup
Expand All @@ -1794,14 +1772,25 @@ static int __lookup_one_len(const char *name, struct qstr *this,
*/
struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
{
int err;
struct qstr this;
unsigned long hash;
unsigned int c;

WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex));

err = __lookup_one_len(name, &this, base, len);
if (err)
return ERR_PTR(err);
this.name = name;
this.len = len;
if (!len)
return ERR_PTR(-EACCES);

hash = init_name_hash();
while (len--) {
c = *(const unsigned char *)name++;
if (c == '/' || c == '\0')
return ERR_PTR(-EACCES);
hash = partial_name_hash(c, hash);
}
this.hash = end_name_hash(hash);

return __lookup_hash(&this, base, NULL);
}
Expand Down

0 comments on commit 7d78f80

Please sign in to comment.