From patchwork Thu Sep 7 00:21:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9941509 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 93635602CC for ; Thu, 7 Sep 2017 00:22:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A596267EC for ; Thu, 7 Sep 2017 00:22:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EFA126AE3; Thu, 7 Sep 2017 00:22:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38F8E267EC for ; Thu, 7 Sep 2017 00:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753555AbdIGAWZ (ORCPT ); Wed, 6 Sep 2017 20:22:25 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33067 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752070AbdIGAVR (ORCPT ); Wed, 6 Sep 2017 20:21:17 -0400 Received: by mail-pf0-f193.google.com with SMTP id h4so352503pfk.0; Wed, 06 Sep 2017 17:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mCG4QAY53E8sFFHLgwn7UqaxaAK9RjaFXmtG+TAQlM4=; b=ZuNql7wqLZfpAhxiwxiEUwhHR3KbN8Q/qJhPkLbnuXaPmP3zjVQIrdKhOL6B1prFT7 2kraFx20eoQIjre7R/OQmRj/jKWJHR+EkkYU8z1WAuRbDyJItSkmyK2xy73+CG0PAngt +YjEjyP5d+tca1mBSPN3Aghth1YSqZrjQJtU+w4ia4QNOz/XKyC8IP0VuRmHsCn7+mmU d+6Nb6yqPXJrsMXZG+Z9l/4yBZa4VeHH7K5jOarIl/7Ji8R5FbFjiBuM1OtzupgiQ3BH r/JttRGwOYFPhkDrXBY8VfA49i50vaSGZRNLdn98vlnNyj7VxRZKjlLHGZBiq75UEjDp Cs5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mCG4QAY53E8sFFHLgwn7UqaxaAK9RjaFXmtG+TAQlM4=; b=jkDuSnd3uCBnaYNLklXJ86+8oicmvwf6vHIiGWKGs6o1UumwdCZHAim8dr5niKxVEW ygMGNDqQc4jL1ZJbb0oeuWfgM5KzEK8vlwn/tTn3fMc6uinB/10GpbztXBl+5izq65hl 86JclHpDYy6oXUHJWMmLhhkDrYCocIsfchG/3voFnLu4o6Y+EWbygWQIEaA5UyFKhCiJ QcaHgSrQ7zEi42C8VZ20okAwKMCJhIRal5f6nwTzcJ9mqEkcxztNpxDHDLT0X73N3dqJ iPwX3xiqqu6GsxFLndXPVjzxV8MkTpx8Uo5XLz8BsTalNQGryihcOoXfo65YsLgSYglD mg3w== X-Gm-Message-State: AHPjjUjgKrmKTmOJtXHY5biX4q9F3UALYE9oFUZlvG8DAyQCoph/Tj00 nyHFNRfBz30dcCCirrw= X-Google-Smtp-Source: ADKCNb40AG1oU34XhzfSI6VJal+aqHjx9tmaHCROKNu32euplOkZEQ00eWIMrpOQ/rAM35RIBfSW3Q== X-Received: by 10.98.76.70 with SMTP id z67mr973672pfa.78.1504743677096; Wed, 06 Sep 2017 17:21:17 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([100.98.112.21]) by smtp.gmail.com with ESMTPSA id d25sm1282515pfb.1.2017.09.06.17.21.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Sep 2017 17:21:16 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Rodrigo Rivas Costa , =?UTF-8?q?Cl=C3=A9ment=20VUCHENER?= , Elias Vanderstuyft , 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 Message-Id: <20170907002112.14097-3-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.14.1.581.gf28d330327-goog In-Reply-To: <20170907002112.14097-1-dmitry.torokhov@gmail.com> References: <20170907002112.14097-1-dmitry.torokhov@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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: