diff options
author | 2022-12-12 10:47:03 -0800 | |
---|---|---|
committer | 2022-12-12 10:47:03 -0800 | |
commit | e291c116f60f3c1ca98090f0f8e7c77e658562fb (patch) | |
tree | 2fbe810f2a6f8b29f1cdaefd87b24debbfa0ec07 /kernel/umh.c | |
parent | Input: raydium_ts_i2c - fix memory leak in raydium_i2c_send() (diff) | |
parent | Input: elants_i2c - delay longer with reset asserted (diff) | |
download | wireguard-linux-e291c116f60f3c1ca98090f0f8e7c77e658562fb.tar.xz wireguard-linux-e291c116f60f3c1ca98090f0f8e7c77e658562fb.zip |
Merge branch 'next' into for-linus
Prepare input updates for 6.2 merge window.
Diffstat (limited to 'kernel/umh.c')
-rw-r--r-- | kernel/umh.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/kernel/umh.c b/kernel/umh.c index b989736e8707..850631518665 100644 --- a/kernel/umh.c +++ b/kernel/umh.c @@ -28,6 +28,7 @@ #include <linux/async.h> #include <linux/uaccess.h> #include <linux/initrd.h> +#include <linux/freezer.h> #include <trace/events/module.h> @@ -403,6 +404,7 @@ EXPORT_SYMBOL(call_usermodehelper_setup); */ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait) { + unsigned int state = TASK_UNINTERRUPTIBLE; DECLARE_COMPLETION_ONSTACK(done); int retval = 0; @@ -436,18 +438,22 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait) if (wait == UMH_NO_WAIT) /* task has freed sub_info */ goto unlock; - if (wait & UMH_KILLABLE) { - retval = wait_for_completion_killable(&done); - if (!retval) - goto wait_done; + if (wait & UMH_KILLABLE) + state |= TASK_KILLABLE; + + if (wait & UMH_FREEZABLE) + state |= TASK_FREEZABLE; + retval = wait_for_completion_state(&done, state); + if (!retval) + goto wait_done; + + if (wait & UMH_KILLABLE) { /* umh_complete() will see NULL and free sub_info */ if (xchg(&sub_info->complete, NULL)) goto unlock; - /* fallthrough, umh_complete() was already called */ } - wait_for_completion(&done); wait_done: retval = sub_info->retval; out: |