]> git.baikalelectronics.ru Git - kernel.git/commit
ktest: Fix while loop in wait_for_input
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 8 Mar 2017 15:16:17 +0000 (10:16 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 8 Mar 2017 15:16:17 +0000 (10:16 -0500)
commitec3372bf7a4faee70a3e5427dceeba113c8cf8ec
tree213b20676928b7ff2f830f4570281650c525c510
parent12e2ba3855126c56e2d47c47d9e0adb4f52b0e6f
ktest: Fix while loop in wait_for_input

The run_command function was changed to use the wait_for_input function to
allow having a timeout if the command to run takes too much time. There was
a bug in the wait_for_input where it could end up going into an infinite
loop. There's two issues here. One is that the return value of the sysread
wasn't used for the write (to write a proper size), and that it should
continue processing the passed in file descriptor too even if there was
input. There was no check for error, if for some reason STDIN returned an
error, the function would go into an infinite loop and never exit.

Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes: 3cc0566330d3 ("ktest: Add timeout to ssh command")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
tools/testing/ktest/ktest.pl