* [PATCH] usb: storage: fix infinite wait loop by incrementing loop counter
@ 2017-02-02 13:19 Colin King
2017-02-02 13:31 ` walter harms
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-02-02 13:19 UTC (permalink / raw)
To: Alan Stern, Greg Kroah-Hartman, linux-usb, usb-storage
Cc: kernel-janitors, linux-kernel, stable
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));
--
2.10.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: storage: fix infinite wait loop by incrementing loop counter
2017-02-02 13:19 [PATCH] usb: storage: fix infinite wait loop by incrementing loop counter Colin King
@ 2017-02-02 13:31 ` walter harms
0 siblings, 0 replies; 2+ messages in thread
From: walter harms @ 2017-02-02 13:31 UTC (permalink / raw)
To: Colin King
Cc: Alan Stern, Greg Kroah-Hartman, linux-usb, usb-storage,
kernel-janitors, linux-kernel, stable
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-02 13:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-02 13:19 [PATCH] usb: storage: fix infinite wait loop by incrementing loop counter Colin King
2017-02-02 13:31 ` walter harms
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).