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.

chroot(2): switch to CLASS(filename)

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

Al Viro 57483461 cbe9e300

+4 -9
+4 -9
fs/open.c
··· 592 592 struct path path; 593 593 int error; 594 594 unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_DIRECTORY; 595 - struct filename *name = getname(filename); 595 + CLASS(filename, name)(filename); 596 596 retry: 597 597 error = filename_lookup(AT_FDCWD, name, lookup_flags, &path, NULL); 598 598 if (error) 599 - goto out; 599 + return error; 600 600 601 601 error = path_permission(&path, MAY_EXEC | MAY_CHDIR); 602 602 if (error) ··· 606 606 if (!ns_capable(current_user_ns(), CAP_SYS_CHROOT)) 607 607 goto dput_and_out; 608 608 error = security_path_chroot(&path); 609 - if (error) 610 - goto dput_and_out; 611 - 612 - set_fs_root(current->fs, &path); 613 - error = 0; 609 + if (!error) 610 + set_fs_root(current->fs, &path); 614 611 dput_and_out: 615 612 path_put(&path); 616 613 if (retry_estale(error, lookup_flags)) { 617 614 lookup_flags |= LOOKUP_REVAL; 618 615 goto retry; 619 616 } 620 - out: 621 - putname(name); 622 617 return error; 623 618 } 624 619