diff --git a/kernel/kmod.c b/kernel/kmod.c
index ad9f2edebd673930c5fd034321f4f271305dda90..6e9b19667a8d2fdff6ac3c0bf76d32d8c1fc4d87 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -235,10 +235,10 @@ static void __call_usermodehelper(struct work_struct *work)
 	case UMH_WAIT_PROC:
 		if (pid > 0)
 			break;
-		sub_info->retval = pid;
 		/* FALLTHROUGH */
-
 	case UMH_WAIT_EXEC:
+		if (pid < 0)
+			sub_info->retval = pid;
 		complete(sub_info->complete);
 	}
 }