On Sun 09-11-25 06:37:37, Al Viro wrote: > Convert the user_path_at() call inside a retry loop into getname_flags() + > filename_lookup() + putname() and leave only filename_lookup() inside > the loop. > > In this case we never pass LOOKUP_EMPTY, so getname_flags() is equivalent > to plain getname(). > > 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 <[email protected]>
Looks good. Feel free to add: Reviewed-by: Jan Kara <[email protected]> Honza > --- > fs/open.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/fs/open.c b/fs/open.c > index e5110f5e80c7..8bc2f313f4a9 100644 > --- a/fs/open.c > +++ b/fs/open.c > @@ -558,8 +558,9 @@ SYSCALL_DEFINE1(chdir, const char __user *, filename) > struct path path; > int error; > unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_DIRECTORY; > + struct filename *name = getname(filename); > retry: > - error = user_path_at(AT_FDCWD, filename, lookup_flags, &path); > + error = filename_lookup(AT_FDCWD, name, lookup_flags, &path, NULL); > if (error) > goto out; > > @@ -576,6 +577,7 @@ SYSCALL_DEFINE1(chdir, const char __user *, filename) > goto retry; > } > out: > + putname(name); > return error; > } > > -- > 2.47.3 > -- Jan Kara <[email protected]> SUSE Labs, CR
