Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347842
b: refs/heads/master
c: 1ac12b4
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Layton authored and Al Viro committed Dec 20, 2012
1 parent b24bbaa commit d09f250
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 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: 7955119e02d9fdf78a39fba8073f19ca6152613e
refs/heads/master: 1ac12b4b6d707937f9de6d09622823b2fd0c93ef
2 changes: 1 addition & 1 deletion trunk/arch/powerpc/platforms/cell/spufs/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static long do_spu_create(const char __user *pathname, unsigned int flags,
struct dentry *dentry;
int ret;

dentry = user_path_create(AT_FDCWD, pathname, &path, 1);
dentry = user_path_create(AT_FDCWD, pathname, &path, LOOKUP_DIRECTORY);
ret = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
ret = spufs_create(&path, dentry, flags, mode, neighbor);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/base/devtmpfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ static int dev_mkdir(const char *name, umode_t mode)
struct path path;
int err;

dentry = kern_path_create(AT_FDCWD, name, &path, 1);
dentry = kern_path_create(AT_FDCWD, name, &path, LOOKUP_DIRECTORY);
if (IS_ERR(dentry))
return PTR_ERR(dentry);

Expand Down
21 changes: 16 additions & 5 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -3030,12 +3030,22 @@ struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt,
return file;
}

struct dentry *kern_path_create(int dfd, const char *pathname, struct path *path, int is_dir)
struct dentry *kern_path_create(int dfd, const char *pathname,
struct path *path, unsigned int lookup_flags)
{
struct dentry *dentry = ERR_PTR(-EEXIST);
struct nameidata nd;
int err2;
int error = do_path_lookup(dfd, pathname, LOOKUP_PARENT, &nd);
int error;
bool is_dir = (lookup_flags & LOOKUP_DIRECTORY);

/*
* Note that only LOOKUP_REVAL and LOOKUP_DIRECTORY matter here. Any
* other flags passed in are ignored!
*/
lookup_flags &= LOOKUP_REVAL;

error = do_path_lookup(dfd, pathname, LOOKUP_PARENT|lookup_flags, &nd);
if (error)
return ERR_PTR(error);

Expand Down Expand Up @@ -3099,13 +3109,14 @@ void done_path_create(struct path *path, struct dentry *dentry)
}
EXPORT_SYMBOL(done_path_create);

struct dentry *user_path_create(int dfd, const char __user *pathname, struct path *path, int is_dir)
struct dentry *user_path_create(int dfd, const char __user *pathname,
struct path *path, unsigned int lookup_flags)
{
struct filename *tmp = getname(pathname);
struct dentry *res;
if (IS_ERR(tmp))
return ERR_CAST(tmp);
res = kern_path_create(dfd, tmp->name, path, is_dir);
res = kern_path_create(dfd, tmp->name, path, lookup_flags);
putname(tmp);
return res;
}
Expand Down Expand Up @@ -3228,7 +3239,7 @@ SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, umode_t, mode)
struct path path;
int error;

dentry = user_path_create(dfd, pathname, &path, 1);
dentry = user_path_create(dfd, pathname, &path, LOOKUP_DIRECTORY);
if (IS_ERR(dentry))
return PTR_ERR(dentry);

Expand Down
4 changes: 2 additions & 2 deletions trunk/include/linux/namei.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ extern int user_path_at_empty(int, const char __user *, unsigned, struct path *,

extern int kern_path(const char *, unsigned, struct path *);

extern struct dentry *kern_path_create(int, const char *, struct path *, int);
extern struct dentry *user_path_create(int, const char __user *, struct path *, int);
extern struct dentry *kern_path_create(int, const char *, struct path *, unsigned int);
extern struct dentry *user_path_create(int, const char __user *, struct path *, unsigned int);
extern void done_path_create(struct path *, struct dentry *);
extern struct dentry *kern_path_locked(const char *, struct path *);
extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
Expand Down

0 comments on commit d09f250

Please sign in to comment.