[PATCH] uml: fix hang on run_helper() failure on uml_net
[firefly-linux-kernel-4.4.55.git] / arch / um / drivers / net_user.c
index 0e2f06187ea7a1b306370edd7ff9baf03c04958b..0a7786e00cfb80da658f6474f562eca1b9d5c067 100644 (file)
@@ -182,7 +182,9 @@ static int change_tramp(char **argv, char *output, int output_len)
        pe_data.stdout = fds[1];
        pid = run_helper(change_pre_exec, &pe_data, argv, NULL);
 
-       read_output(fds[0], output, output_len);
+       if (pid > 0)    /* Avoid hang as we won't get data in failure case. */
+               read_output(fds[0], output, output_len);
+
        os_close_file(fds[0]);
        os_close_file(fds[1]);