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_faccessat(): 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 0cf11496 24df85ff

+4 -3
+4 -3
fs/open.c
··· 468 468 int res; 469 469 unsigned int lookup_flags = LOOKUP_FOLLOW; 470 470 const struct cred *old_cred = NULL; 471 + struct filename *name; 471 472 472 473 if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */ 473 474 return -EINVAL; ··· 478 477 479 478 if (flags & AT_SYMLINK_NOFOLLOW) 480 479 lookup_flags &= ~LOOKUP_FOLLOW; 481 - if (flags & AT_EMPTY_PATH) 482 - lookup_flags |= LOOKUP_EMPTY; 483 480 484 481 if (access_need_override_creds(flags)) { 485 482 old_cred = access_override_creds(); ··· 485 486 return -ENOMEM; 486 487 } 487 488 489 + name = getname_uflags(filename, flags); 488 490 retry: 489 - res = user_path_at(dfd, filename, lookup_flags, &path); 491 + res = filename_lookup(dfd, name, lookup_flags, &path, NULL); 490 492 if (res) 491 493 goto out; 492 494 ··· 527 527 goto retry; 528 528 } 529 529 out: 530 + putname(name); 530 531 if (old_cred) 531 532 put_cred(revert_creds(old_cred)); 532 533