mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org
Cc: "Rodrigo Rivas Costa" <rodrigorivascosta@gmail.com>,
	"Clément VUCHENER" <clement.vuchener@gmail.com>,
	"Elias Vanderstuyft" <elias.vds@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/6] Input: uinput - allow FF requests to time out
Date: Wed,  6 Sep 2017 17:21:09 -0700	[thread overview]
Message-ID: <20170907002112.14097-3-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20170907002112.14097-1-dmitry.torokhov@gmail.com>

Previously uinput force feedback requests waited for the userspace
indefinitely, which caused users to block when uinput server process
become unresponsive. Let's establish a 30 seconds deadline for servicing
upload and erase force feedback effect actions, so that users have a
chance to abort stuck requests.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/misc/uinput.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 443151de90c6..c30704fa1a06 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -149,7 +149,11 @@ static int uinput_request_submit(struct uinput_device *udev,
 	if (retval)
 		goto out;
 
-	wait_for_completion(&request->done);
+	if (!wait_for_completion_timeout(&request->done, 30 * HZ)) {
+		retval = -ETIMEDOUT;
+		goto out;
+	}
+
 	retval = request->retval;
 
  out:
-- 
2.14.1.581.gf28d330327-goog

  parent reply	other threads:[~2017-09-07  0:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-07  0:21 [PATCH 1/6] Input: uinput - avoid FF flush when destroying device Dmitry Torokhov
2017-09-07  0:21 ` [PATCH 2/6] Input: uinput - avoid crash when sending FF request to device going away Dmitry Torokhov
2017-09-07  0:21 ` Dmitry Torokhov [this message]
2017-09-07  0:21 ` [PATCH 4/6] Input: uinput - fix coding style in uinput_ioctl_handler() Dmitry Torokhov
2017-09-07  0:21 ` [PATCH 5/6] Input: uinput - remove uinput_allocate_device() Dmitry Torokhov
2017-09-07  0:21 ` [PATCH 6/6] Input: uinput - fold header into the driver proper Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170907002112.14097-3-dmitry.torokhov@gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=clement.vuchener@gmail.com \
    --cc=elias.vds@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rodrigorivascosta@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®