diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-06-05 16:38:18 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-12-05 19:11:57 -0500 |
commit | c1d4dd27678fc6892e30ea3de4a7caf86f39df1c (patch) | |
tree | 94824dd01d21c8567fa431fc4a3c5ddc6d2f2aa3 /fs/namei.c | |
parent | e5517c2a5a49ed5e99047008629f1cd60246ea0e (diff) |
namei.c: get rid of user_path_parent()
direct use of filename_parentat() is just as readable
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/fs/namei.c b/fs/namei.c index 5b4eed221530..85d2097fec9a 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2558,24 +2558,6 @@ int user_path_at_empty(int dfd, const char __user *name, unsigned flags, | |||
2558 | } | 2558 | } |
2559 | EXPORT_SYMBOL(user_path_at_empty); | 2559 | EXPORT_SYMBOL(user_path_at_empty); |
2560 | 2560 | ||
2561 | /* | ||
2562 | * NB: most callers don't do anything directly with the reference to the | ||
2563 | * to struct filename, but the nd->last pointer points into the name string | ||
2564 | * allocated by getname. So we must hold the reference to it until all | ||
2565 | * path-walking is complete. | ||
2566 | */ | ||
2567 | static inline struct filename * | ||
2568 | user_path_parent(int dfd, const char __user *path, | ||
2569 | struct path *parent, | ||
2570 | struct qstr *last, | ||
2571 | int *type, | ||
2572 | unsigned int flags) | ||
2573 | { | ||
2574 | /* only LOOKUP_REVAL is allowed in extra flags */ | ||
2575 | return filename_parentat(dfd, getname(path), flags & LOOKUP_REVAL, | ||
2576 | parent, last, type); | ||
2577 | } | ||
2578 | |||
2579 | /** | 2561 | /** |
2580 | * mountpoint_last - look up last component for umount | 2562 | * mountpoint_last - look up last component for umount |
2581 | * @nd: pathwalk nameidata - currently pointing at parent directory of "last" | 2563 | * @nd: pathwalk nameidata - currently pointing at parent directory of "last" |
@@ -3861,8 +3843,8 @@ static long do_rmdir(int dfd, const char __user *pathname) | |||
3861 | int type; | 3843 | int type; |
3862 | unsigned int lookup_flags = 0; | 3844 | unsigned int lookup_flags = 0; |
3863 | retry: | 3845 | retry: |
3864 | name = user_path_parent(dfd, pathname, | 3846 | name = filename_parentat(dfd, getname(pathname), lookup_flags, |
3865 | &path, &last, &type, lookup_flags); | 3847 | &path, &last, &type); |
3866 | if (IS_ERR(name)) | 3848 | if (IS_ERR(name)) |
3867 | return PTR_ERR(name); | 3849 | return PTR_ERR(name); |
3868 | 3850 | ||
@@ -3991,8 +3973,8 @@ static long do_unlinkat(int dfd, const char __user *pathname) | |||
3991 | struct inode *delegated_inode = NULL; | 3973 | struct inode *delegated_inode = NULL; |
3992 | unsigned int lookup_flags = 0; | 3974 | unsigned int lookup_flags = 0; |
3993 | retry: | 3975 | retry: |
3994 | name = user_path_parent(dfd, pathname, | 3976 | name = filename_parentat(dfd, getname(pathname), lookup_flags, |
3995 | &path, &last, &type, lookup_flags); | 3977 | &path, &last, &type); |
3996 | if (IS_ERR(name)) | 3978 | if (IS_ERR(name)) |
3997 | return PTR_ERR(name); | 3979 | return PTR_ERR(name); |
3998 | 3980 | ||
@@ -4491,15 +4473,15 @@ SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname, | |||
4491 | target_flags = 0; | 4473 | target_flags = 0; |
4492 | 4474 | ||
4493 | retry: | 4475 | retry: |
4494 | from = user_path_parent(olddfd, oldname, | 4476 | from = filename_parentat(olddfd, getname(oldname), lookup_flags, |
4495 | &old_path, &old_last, &old_type, lookup_flags); | 4477 | &old_path, &old_last, &old_type); |
4496 | if (IS_ERR(from)) { | 4478 | if (IS_ERR(from)) { |
4497 | error = PTR_ERR(from); | 4479 | error = PTR_ERR(from); |
4498 | goto exit; | 4480 | goto exit; |
4499 | } | 4481 | } |
4500 | 4482 | ||
4501 | to = user_path_parent(newdfd, newname, | 4483 | to = filename_parentat(newdfd, getname(newname), lookup_flags, |
4502 | &new_path, &new_last, &new_type, lookup_flags); | 4484 | &new_path, &new_last, &new_type); |
4503 | if (IS_ERR(to)) { | 4485 | if (IS_ERR(to)) { |
4504 | error = PTR_ERR(to); | 4486 | error = PTR_ERR(to); |
4505 | goto exit1; | 4487 | goto exit1; |