Re: [PATCH v2] uinput: Use wait_for_completion_interruptible_timeout in uinput_request_submit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Humble ping :)

On 2/24/19 10:30 AM, Marcos Paulo de Souza wrote:
> Without this change, userspace could get stuck in a UINTERRUPTIBLE sleep
> for 30 seconds when a supporing force feedback is being destroyed.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=193741
> Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@xxxxxxxxx>
> ---
>  Changes from v1:
>  * Add different return value when wait_for_completion_timeout is interrupted
>    or times out
> 
>  drivers/input/misc/uinput.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
> index 26ec603fe220..3ddf14acdad7 100644
> --- a/drivers/input/misc/uinput.c
> +++ b/drivers/input/misc/uinput.c
> @@ -191,8 +191,13 @@ static int uinput_request_submit(struct uinput_device *udev,
>  	if (retval)
>  		goto out;
>  
> -	if (!wait_for_completion_timeout(&request->done, 30 * HZ)) {
> -		retval = -ETIMEDOUT;
> +	/* wait_for_completion_interruptible_timeout returns 0 when timed out
> +	 * and ERESTARTSYS when interrupted
> +	 */
> +	retval = wait_for_completion_interruptible_timeout(&request->done,
> +							30 * HZ);
> +	if (retval <= 0) {
> +		retval = retval < 0 ? retval : -ETIMEDOUT;
>  		goto out;
>  	}
>  
> 



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux