Skip to content

Commit b044fa2

Browse files
committed
umh: Move setting PF_UMH into umh_pipe_setup
I am separating the code specific to user mode drivers from the code for ordinary user space helpers. Move setting of PF_UMH from call_usermodehelper_exec_async which is core user mode helper code into umh_pipe_setup which is user mode driver code. The code is equally as easy to write in one location as the other and the movement minimizes the impact of the user mode driver code on the core of the user mode helper code. Setting PF_UMH unconditionally is harmless as an action will only happen if it is paired with an entry on umh_list. v1: https://lkml.kernel.org/r/[email protected] v2: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Reviewed-by: Greg Kroah-Hartman <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Tested-by: Alexei Starovoitov <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]>
1 parent 5fec25f commit b044fa2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

kernel/umh.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,10 @@ static int call_usermodehelper_exec_async(void *data)
102102

103103
commit_creds(new);
104104

105-
if (sub_info->file) {
105+
if (sub_info->file)
106106
retval = do_execve_file(sub_info->file,
107107
sub_info->argv, sub_info->envp);
108-
if (!retval)
109-
current->flags |= PF_UMH;
110-
} else
108+
else
111109
retval = do_execve(getname_kernel(sub_info->path),
112110
(const char __user *const __user *)sub_info->argv,
113111
(const char __user *const __user *)sub_info->envp);
@@ -468,6 +466,7 @@ static int umh_pipe_setup(struct subprocess_info *info, struct cred *new)
468466
umh_info->pipe_to_umh = to_umh[1];
469467
umh_info->pipe_from_umh = from_umh[0];
470468
umh_info->pid = task_pid_nr(current);
469+
current->flags |= PF_UMH;
471470
return 0;
472471
}
473472

0 commit comments

Comments
 (0)