Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

do_fchownat(): import pathname only once

Convert the user_path_at() call inside a retry loop into getname_flags() +
filename_lookup() + putname() and leave only filename_lookup() inside
the loop.

Since we have the default logics for use of LOOKUP_EMPTY (passed iff
AT_EMPTY_PATH is present in flags), just use getname_uflags() and
don't bother with setting LOOKUP_EMPTY in lookup_flags - getname_uflags()
will pass the right thing to getname_flags() and filename_lookup()
doesn't care about LOOKUP_EMPTY at all.

The things could be further simplified by use of cleanup.h stuff, but
let's not clutter the patch with that.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 2e2d892f 67591df9

+6 -5
+6 -5
fs/open.c
··· 801 801 int flag) 802 802 { 803 803 struct path path; 804 - int error = -EINVAL; 804 + int error; 805 805 int lookup_flags; 806 + struct filename *name; 806 807 807 808 if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH)) != 0) 808 - goto out; 809 + return -EINVAL; 809 810 810 811 lookup_flags = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW; 811 - if (flag & AT_EMPTY_PATH) 812 - lookup_flags |= LOOKUP_EMPTY; 812 + name = getname_uflags(filename, flag); 813 813 retry: 814 - error = user_path_at(dfd, filename, lookup_flags, &path); 814 + error = filename_lookup(dfd, name, lookup_flags, &path, NULL); 815 815 if (error) 816 816 goto out; 817 817 error = mnt_want_write(path.mnt); ··· 826 826 goto retry; 827 827 } 828 828 out: 829 + putname(name); 829 830 return error; 830 831 } 831 832