Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1572366

Re: [PATCH] usb: storage: fix infinite wait loop by incrementing loop counter

Path csiph.com!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From walter harms <wharms@bfs.de>
Newsgroups linux.kernel
Subject Re: [PATCH] usb: storage: fix infinite wait loop by incrementing loop counter
Date Thu, 02 Feb 2017 14:40:02 +0100
Message-ID <t6pMe-4F2-15@gated-at.bofh.it> (permalink)
References <t6pCz-4Bc-41@gated-at.bofh.it>
X-Original-To Colin King <colin.king@canonical.com>
Reply-To wharms@bfs.de
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 47
Organization linux.* mail to news gateway
X-Original-Cc Alan Stern <stern@rowland.harvard.edu>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org
X-Original-Date Thu, 02 Feb 2017 14:31:45 +0100
X-Original-Message-ID <589334C1.7020802@bfs.de>
X-Original-References <20170202131910.31001-1-colin.king@canonical.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1572366

Show key headers only | View raw



Am 02.02.2017 14:19, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
> 
> If jumpshot_get_status continues to return a failed result then the
> wait loop will spin forever because the waitcount counter is never
> being incremented and we don't ever timeout.  Fix this by incrementing
> waitcount.
> 
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/usb/storage/jumpshot.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
> index 011e527..81d82ce 100644
> --- a/drivers/usb/storage/jumpshot.c
> +++ b/drivers/usb/storage/jumpshot.c
> @@ -311,6 +311,7 @@ static int jumpshot_write_data(struct us_data *us,
>  			if (result != USB_STOR_TRANSPORT_GOOD) {
>  				// I have not experimented to find the smallest value.
>  				//
> +				waitcount++;
>  				msleep(50); 
>  			}
>  		} while ((result != USB_STOR_TRANSPORT_GOOD) && (waitcount < 10));


the function looks a bit complicated ..
what i about this ?

for(waitcount=0;waitcount<10;waitcount++)
{
   result = jumpshot_get_status(us);
   if ( result == USB_STOR_TRANSPORT_GOOD)
	break;

   msleep(50);

}

just my 2 cents,

re,
 wg

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] usb: storage: fix infinite wait loop by incrementing loop counter Colin King <colin.king@canonical.com> - 2017-02-02 14:30 +0100
  Re: [PATCH] usb: storage: fix infinite wait loop by incrementing  loop counter walter harms <wharms@bfs.de> - 2017-02-02 14:40 +0100

csiph-web