From: walter harms <wharms@bfs.de>
To: Colin King <colin.king@canonical.com>
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
Subject: Re: [PATCH] usb: storage: fix infinite wait loop by incrementing loop counter
Date: Thu, 02 Feb 2017 14:31:45 +0100 [thread overview]
Message-ID: <589334C1.7020802@bfs.de> (raw)
In-Reply-To: <20170202131910.31001-1-colin.king@canonical.com>
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
prev parent reply other threads:[~2017-02-02 13:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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=589334C1.7020802@bfs.de \
--to=wharms@bfs.de \
--cc=colin.king@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=usb-storage@lists.one-eyed-alien.net \
/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;
as well as URLs for NNTP newsgroup(s).