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_fchmodat(): 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 67591df9 0cf11496

+4 -4
+4 -4
fs/open.c
··· 679 679 unsigned int flags) 680 680 { 681 681 struct path path; 682 + struct filename *name; 682 683 int error; 683 684 unsigned int lookup_flags; 684 685 ··· 687 686 return -EINVAL; 688 687 689 688 lookup_flags = (flags & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW; 690 - if (flags & AT_EMPTY_PATH) 691 - lookup_flags |= LOOKUP_EMPTY; 692 - 689 + name = getname_uflags(filename, flags); 693 690 retry: 694 - error = user_path_at(dfd, filename, lookup_flags, &path); 691 + error = filename_lookup(dfd, name, lookup_flags, &path, NULL); 695 692 if (!error) { 696 693 error = chmod_common(&path, mode); 697 694 path_put(&path); ··· 698 699 goto retry; 699 700 } 700 701 } 702 + putname(name); 701 703 return error; 702 704 } 703 705