mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
nsfs: convert open_namespace() to FD_PREPARE()
Link: https://patch.msgid.link/20251123-work-fd-prepare-v4-9-b6efa1706cfd@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
7129098f4f
commit
00de6e2448
12
fs/nsfs.c
12
fs/nsfs.c
|
|
@ -108,7 +108,6 @@ int ns_get_path(struct path *path, struct task_struct *task,
|
|||
int open_namespace(struct ns_common *ns)
|
||||
{
|
||||
struct path path __free(path_put) = {};
|
||||
struct file *f;
|
||||
int err;
|
||||
|
||||
/* call first to consume reference */
|
||||
|
|
@ -116,16 +115,7 @@ int open_namespace(struct ns_common *ns)
|
|||
if (err < 0)
|
||||
return err;
|
||||
|
||||
CLASS(get_unused_fd, fd)(O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
f = dentry_open(&path, O_RDONLY, current_cred());
|
||||
if (IS_ERR(f))
|
||||
return PTR_ERR(f);
|
||||
|
||||
fd_install(fd, f);
|
||||
return take_fd(fd);
|
||||
return FD_ADD(O_CLOEXEC, dentry_open(&path, O_RDONLY, current_cred()));
|
||||
}
|
||||
|
||||
int open_related_ns(struct ns_common *ns,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user