summaryrefslogtreecommitdiffstats
path: root/kernel/umh.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2020-06-24 16:34:57 -0500
committerEric W. Biederman <ebiederm@xmission.com>2020-07-04 09:33:40 -0500
commit5fec25f2cb959cb5f189d7f6127bee3efc782530 (patch)
tree32bd4073caaf2c279e0d97e1e3dce5084ebc8a7f /kernel/umh.c
parentb3a9e3b9622ae10064826dccb4f7a52bd88c7407 (diff)
downloadlinux-5fec25f2cb959cb5f189d7f6127bee3efc782530.tar.gz
linux-5fec25f2cb959cb5f189d7f6127bee3efc782530.tar.bz2
linux-5fec25f2cb959cb5f189d7f6127bee3efc782530.zip
umh: Capture the pid in umh_pipe_setup
The pid in struct subprocess_info is only used by umh_clean_and_save_pid to write the pid into umh_info. Instead always capture the pid on struct umh_info in umh_pipe_setup, removing code that is specific to user mode drivers from the common user path of user mode helpers. v1: https://lkml.kernel.org/r/87h7uygf9i.fsf_-_@x220.int.ebiederm.org v2: https://lkml.kernel.org/r/875zb97iix.fsf_-_@x220.int.ebiederm.org Link: https://lkml.kernel.org/r/20200702164140.4468-1-ebiederm@xmission.com Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Alexei Starovoitov <ast@kernel.org> Tested-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'kernel/umh.c')
-rw-r--r--kernel/umh.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/umh.c b/kernel/umh.c
index 79f139a7ca03..c2a582b3a2bf 100644
--- a/kernel/umh.c
+++ b/kernel/umh.c
@@ -102,7 +102,6 @@ static int call_usermodehelper_exec_async(void *data)
commit_creds(new);
- sub_info->pid = task_pid_nr(current);
if (sub_info->file) {
retval = do_execve_file(sub_info->file,
sub_info->argv, sub_info->envp);
@@ -468,6 +467,7 @@ static int umh_pipe_setup(struct subprocess_info *info, struct cred *new)
umh_info->pipe_to_umh = to_umh[1];
umh_info->pipe_from_umh = from_umh[0];
+ umh_info->pid = task_pid_nr(current);
return 0;
}
@@ -476,13 +476,12 @@ static void umh_clean_and_save_pid(struct subprocess_info *info)
struct umh_info *umh_info = info->data;
/* cleanup if umh_pipe_setup() was successful but exec failed */
- if (info->pid && info->retval) {
+ if (info->retval) {
fput(umh_info->pipe_to_umh);
fput(umh_info->pipe_from_umh);
}
argv_free(info->argv);
- umh_info->pid = info->pid;
}
/**