Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 234273
b: refs/heads/master
c: f52e0c1
h: refs/heads/master
i:
  234271: 6613994
v: v3
  • Loading branch information
Al Viro committed Mar 14, 2011
1 parent 79c5a1b commit 0ecf517
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 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: 5fe0c2378884e68beb532f5890cc0e3539ac747b
refs/heads/master: f52e0c11305aa09ed56cad97ffc8f0cdc3d78b5d
29 changes: 19 additions & 10 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static int do_getname(const char __user *filename, char *page)
return retval;
}

char * getname(const char __user * filename)
static char *getname_flags(const char __user * filename, int flags)
{
char *tmp, *result;

Expand All @@ -147,14 +147,21 @@ char * getname(const char __user * filename)

result = tmp;
if (retval < 0) {
__putname(tmp);
result = ERR_PTR(retval);
if (retval != -ENOENT || !(flags & LOOKUP_EMPTY)) {
__putname(tmp);
result = ERR_PTR(retval);
}
}
}
audit_getname(result);
return result;
}

char *getname(const char __user * filename)
{
return getname_flags(filename, 0);
}

#ifdef CONFIG_AUDITSYSCALL
void putname(const char *name)
{
Expand Down Expand Up @@ -1544,13 +1551,15 @@ static int path_init(int dfd, const char *name, unsigned int flags,

dentry = file->f_path.dentry;

retval = -ENOTDIR;
if (!S_ISDIR(dentry->d_inode->i_mode))
goto fput_fail;
if (*name) {
retval = -ENOTDIR;
if (!S_ISDIR(dentry->d_inode->i_mode))
goto fput_fail;

retval = file_permission(file, MAY_EXEC);
if (retval)
goto fput_fail;
retval = file_permission(file, MAY_EXEC);
if (retval)
goto fput_fail;
}

nd->path = file->f_path;
if (flags & LOOKUP_RCU) {
Expand Down Expand Up @@ -1759,7 +1768,7 @@ int user_path_at(int dfd, const char __user *name, unsigned flags,
struct path *path)
{
struct nameidata nd;
char *tmp = getname(name);
char *tmp = getname_flags(name, flags);
int err = PTR_ERR(tmp);
if (!IS_ERR(tmp)) {

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
unlinking file. */
#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */
#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */

#ifdef __KERNEL__

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/namei.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};

#define LOOKUP_JUMPED 0x1000
#define LOOKUP_ROOT 0x2000
#define LOOKUP_EMPTY 0x4000

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

Expand Down

0 comments on commit 0ecf517

Please sign in to comment.