Re: [PATCH] Input: uinput - Allow uinput_request to be interrupted

From: Dmitry Torokhov
Date: Mon Feb 18 2019 - 01:46:35 EST


Hi Marcos,

On Sun, Feb 17, 2019 at 09:42:52PM -0300, Marcos Paulo de Souza wrote:
> Commit 8e009118a45a ("Input: uinput - allow FF requests to time out")
> sets a timeout of 30 seconds to wait for force feedback interaction with
> userspace, but also made it impossible to interrupt the event handling of
> uinput code.

No, the original code was using wait_for_completion() and therefore did
not allow interrupting FF requests either. I'll apply the patch, but
will drop the "Fixes" reference.

Thanks.

> Make it interrutible by changing from
> wait_for_completion_timeout to wait_for_completion_interruptible_timeout.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=193741
>
> Fixes: 8e009118a45a ("Input: uinput - allow FF requests to time out")
> Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@xxxxxxxxx>
> ---
> drivers/input/misc/uinput.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
> index 26ec603fe220..b7bdf332ef4c 100644
> --- a/drivers/input/misc/uinput.c
> +++ b/drivers/input/misc/uinput.c
> @@ -191,7 +191,8 @@ static int uinput_request_submit(struct uinput_device *udev,
> if (retval)
> goto out;
>
> - if (!wait_for_completion_timeout(&request->done, 30 * HZ)) {
> + if (!wait_for_completion_interruptible_timeout(&request->done,
> + 30 * HZ)) {
> retval = -ETIMEDOUT;
> goto out;
> }
> --
> 2.16.4
>

--
Dmitry