Merge tag 'sound-fix-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[platform/kernel/linux-starfive.git] / kernel / umh.c
index 8945eaf..8506315 100644 (file)
@@ -404,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;
 
@@ -437,25 +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)
+               state |= TASK_KILLABLE;
+
        if (wait & UMH_FREEZABLE)
-               freezer_do_not_count();
+               state |= TASK_FREEZABLE;
 
-       if (wait & UMH_KILLABLE) {
-               retval = wait_for_completion_killable(&done);
-               if (!retval)
-                       goto wait_done;
+       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);
-
-       if (wait & UMH_FREEZABLE)
-               freezer_count();
-
 wait_done:
        retval = sub_info->retval;
 out: