From patchwork Mon Jun 30 11:51:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 32701 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 36E52203C0 for ; Mon, 30 Jun 2014 12:03:03 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id kq14sf43484204pab.0 for ; Mon, 30 Jun 2014 05:03:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=wjNR2sjZ2c3/nPqY6f3uCGgwutCuZaXL7TDoJH2pUVo=; b=JVF5K1FrR1fLgsgtsGoy3PKRa/kxamVr3wJOMNjR7JGZf5Q5av0C9jl3X4AkYhwJ4y EpzlbBuQTFAXDxHbJ85hnAf5xbOx3b5mMoAkwFYZBd2PlPrnLXBdQk7kl04EMkyCmY+K j4FeCDmJYLXWgE0224/yjYzcrHwpQrQ/NPkuEc8jYEr9+Dw/isk/zl/2bg/pSuOAQDbg bWdtXYMf5KunMlC7kz1/JbWmrPDTBeFPuFv9weFRW/Lz3xCn2S1IM0hGnTIPubY1/u8Z 6aZuub29u7m+q9ljDYx+ZUxa7tvAavxcudlM9L+aQUCHzdO7sZ6SgER0eQFMONAOaIqp mupA== X-Gm-Message-State: ALoCoQmziT+W3Qg9CIUhZMt5s9ApYQDJBGRtXwQTxMZ7eS4fO80cuBBdfJ9XYxQjsMbNXs3mO2T6 X-Received: by 10.66.65.202 with SMTP id z10mr21946283pas.45.1404129782558; Mon, 30 Jun 2014 05:03:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.163 with SMTP id g32ls144171qge.17.gmail; Mon, 30 Jun 2014 05:03:02 -0700 (PDT) X-Received: by 10.58.112.65 with SMTP id io1mr9214veb.61.1404129782327; Mon, 30 Jun 2014 05:03:02 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id w4si9923452vct.72.2014.06.30.05.03.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 05:03:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.181 as permitted sender) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id db11so7926643veb.40 for ; Mon, 30 Jun 2014 05:03:02 -0700 (PDT) X-Received: by 10.52.30.9 with SMTP id o9mr31550412vdh.15.1404129782249; Mon, 30 Jun 2014 05:03:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp131860vcb; Mon, 30 Jun 2014 05:03:01 -0700 (PDT) X-Received: by 10.66.254.166 with SMTP id aj6mr52215711pad.11.1404129781409; Mon, 30 Jun 2014 05:03:01 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id og8si22882902pbb.215.2014.06.30.05.03.00; Mon, 30 Jun 2014 05:03:00 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755613AbaF3MC2 (ORCPT + 27 others); Mon, 30 Jun 2014 08:02:28 -0400 Received: from ip4-83-240-18-248.cust.nbox.cz ([83.240.18.248]:52052 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753893AbaF3Lx0 (ORCPT ); Mon, 30 Jun 2014 07:53:26 -0400 Received: from ku by ip4-83-240-18-248.cust.nbox.cz with local (Exim 4.80.1) (envelope-from ) id 1X1a9D-0000h1-T3; Mon, 30 Jun 2014 13:53:23 +0200 From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Roger Quadros , Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH 3.12 094/181] usb: usbtest: Add timetout to simple_io() Date: Mon, 30 Jun 2014 13:51:55 +0200 Message-Id: <5e13a4925da0ba2483d49f52fe8c049ec461c5ac.1404128998.git.jslaby@suse.cz> X-Mailer: git-send-email 2.0.0 In-Reply-To: <61844d8e25eb8899b0836afa9796fa239db80f1f.1404128997.git.jslaby@suse.cz> References: <61844d8e25eb8899b0836afa9796fa239db80f1f.1404128997.git.jslaby@suse.cz> In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linux-kernel-owner@vger.kernel.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Roger Quadros 3.12-stable review patch. If anyone has any objections, please let me know. =============== commit e5e4746510d140261918aecce2e5e3aa4456f7e9 upstream. Without a timetout some tests e.g. test_halt() can remain stuck forever. Signed-off-by: Roger Quadros Reviewed-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Jiri Slaby --- drivers/usb/misc/usbtest.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index aa28ac8c7607..afe616b55f01 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -10,6 +10,7 @@ #include +#define SIMPLE_IO_TIMEOUT 10000 /* in milliseconds */ /*-------------------------------------------------------------------------*/ @@ -366,6 +367,7 @@ static int simple_io( int max = urb->transfer_buffer_length; struct completion completion; int retval = 0; + unsigned long expire; urb->context = &completion; while (retval == 0 && iterations-- > 0) { @@ -378,9 +380,15 @@ static int simple_io( if (retval != 0) break; - /* NOTE: no timeouts; can't be broken out of by interrupt */ - wait_for_completion(&completion); - retval = urb->status; + expire = msecs_to_jiffies(SIMPLE_IO_TIMEOUT); + if (!wait_for_completion_timeout(&completion, expire)) { + usb_kill_urb(urb); + retval = (urb->status == -ENOENT ? + -ETIMEDOUT : urb->status); + } else { + retval = urb->status; + } + urb->dev = udev; if (retval == 0 && usb_pipein(urb->pipe)) retval = simple_check_buf(tdev, urb);