* [patch] qla2xxx: fix a timeout loop
@ 2015-12-16 11:07 Dan Carpenter
2015-12-16 11:45 ` Johannes Thumshirn
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Dan Carpenter @ 2015-12-16 11:07 UTC (permalink / raw)
To: qla2xxx-upstream, Atul Deshmukh
Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
kernel-janitors
After the loop we test for "if (!retries) " as a failure, but actually
the post-op here will end with retries set to -1. I have fixed this by
using a pre-op instead.
Fixes: 7ec0effd30bb ('[SCSI] qla2xxx: Add support for ISP8044.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
index 007192d..66d629e 100644
--- a/drivers/scsi/qla2xxx/qla_nx2.c
+++ b/drivers/scsi/qla2xxx/qla_nx2.c
@@ -3491,7 +3491,7 @@ qla8044_poll_flash_status_reg(struct scsi_qla_host *vha)
int retries = QLA8044_FLASH_READ_RETRY_COUNT;
int ret_val = QLA_SUCCESS;
- while (retries--) {
+ while (--retries) {
ret_val = qla8044_rd_reg_indirect(vha, QLA8044_FLASH_STATUS,
&flash_status);
if (ret_val) {
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch] qla2xxx: fix a timeout loop
2015-12-16 11:07 [patch] qla2xxx: fix a timeout loop Dan Carpenter
@ 2015-12-16 11:45 ` Johannes Thumshirn
2015-12-16 22:50 ` Martin K. Petersen
2015-12-17 1:25 ` Himanshu Madhani
2 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2015-12-16 11:45 UTC (permalink / raw)
To: Dan Carpenter
Cc: qla2xxx-upstream, Atul Deshmukh, James E.J. Bottomley,
Martin K. Petersen, linux-scsi, kernel-janitors
On Wed, Dec 16, 2015 at 02:07:46PM +0300, Dan Carpenter wrote:
> After the loop we test for "if (!retries) " as a failure, but actually
> the post-op here will end with retries set to -1. I have fixed this by
> using a pre-op instead.
>
> Fixes: 7ec0effd30bb ('[SCSI] qla2xxx: Add support for ISP8044.')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
> index 007192d..66d629e 100644
> --- a/drivers/scsi/qla2xxx/qla_nx2.c
> +++ b/drivers/scsi/qla2xxx/qla_nx2.c
> @@ -3491,7 +3491,7 @@ qla8044_poll_flash_status_reg(struct scsi_qla_host *vha)
> int retries = QLA8044_FLASH_READ_RETRY_COUNT;
> int ret_val = QLA_SUCCESS;
>
> - while (retries--) {
> + while (--retries) {
> ret_val = qla8044_rd_reg_indirect(vha, QLA8044_FLASH_STATUS,
> &flash_status);
> if (ret_val) {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Good catch.
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] qla2xxx: fix a timeout loop
2015-12-16 11:07 [patch] qla2xxx: fix a timeout loop Dan Carpenter
2015-12-16 11:45 ` Johannes Thumshirn
@ 2015-12-16 22:50 ` Martin K. Petersen
2015-12-17 10:46 ` Dan Carpenter
2015-12-17 1:25 ` Himanshu Madhani
2 siblings, 1 reply; 6+ messages in thread
From: Martin K. Petersen @ 2015-12-16 22:50 UTC (permalink / raw)
To: Dan Carpenter
Cc: qla2xxx-upstream, Atul Deshmukh, James E.J. Bottomley,
Martin K. Petersen, linux-scsi, kernel-janitors,
Johannes Thumshirn
>>>>> "Dan" = Dan Carpenter <dan.carpenter@oracle.com> writes:
Dan> After the loop we test for "if (!retries) " as a failure, but
Dan> actually the post-op here will end with retries set to -1. I have
Dan> fixed this by using a pre-op instead.
Applied to 4.4/scsi-fixes.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] qla2xxx: fix a timeout loop
2015-12-16 11:07 [patch] qla2xxx: fix a timeout loop Dan Carpenter
2015-12-16 11:45 ` Johannes Thumshirn
2015-12-16 22:50 ` Martin K. Petersen
@ 2015-12-17 1:25 ` Himanshu Madhani
2 siblings, 0 replies; 6+ messages in thread
From: Himanshu Madhani @ 2015-12-17 1:25 UTC (permalink / raw)
To: Dan Carpenter, Dept-Eng QLA2xxx Upstream
Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
kernel-janitors@vger.kernel.org
Hi Dan,
On 12/16/15, 3:07 AM, "linux-scsi-owner@vger.kernel.org on behalf of Dan
Carpenter" <linux-scsi-owner@vger.kernel.org on behalf of
dan.carpenter@oracle.com> wrote:
>After the loop we test for "if (!retries) " as a failure, but actually
>the post-op here will end with retries set to -1. I have fixed this by
>using a pre-op instead.
>
>Fixes: 7ec0effd30bb ('[SCSI] qla2xxx: Add support for ISP8044.')
>Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
>diff --git a/drivers/scsi/qla2xxx/qla_nx2.c
>b/drivers/scsi/qla2xxx/qla_nx2.c
>index 007192d..66d629e 100644
>--- a/drivers/scsi/qla2xxx/qla_nx2.c
>+++ b/drivers/scsi/qla2xxx/qla_nx2.c
>@@ -3491,7 +3491,7 @@ qla8044_poll_flash_status_reg(struct scsi_qla_host
>*vha)
> int retries = QLA8044_FLASH_READ_RETRY_COUNT;
> int ret_val = QLA_SUCCESS;
>
>- while (retries--) {
>+ while (--retries) {
> ret_val = qla8044_rd_reg_indirect(vha, QLA8044_FLASH_STATUS,
> &flash_status);
> if (ret_val) {
There is flaw in this pre-decrement logic here for following 2 reasons
1. The pre-decrement reduces the total number of retries by one
2. If the retries is already Zero, then the pre-decrement would cause loop
to iterate for a very large number of times.
The correct fix for this would be to change the if(!retries) to if
(retries = -1) or if (retries < 0)
We¹ll send a follow up patch to fix this.
Thanks,
Himanshu
>--
>To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] qla2xxx: fix a timeout loop
2015-12-16 22:50 ` Martin K. Petersen
@ 2015-12-17 10:46 ` Dan Carpenter
2015-12-17 16:47 ` Martin K. Petersen
0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2015-12-17 10:46 UTC (permalink / raw)
To: Martin K. Petersen
Cc: qla2xxx-upstream, Atul Deshmukh, James E.J. Bottomley, linux-scsi,
kernel-janitors, Johannes Thumshirn
On Wed, Dec 16, 2015 at 05:50:17PM -0500, Martin K. Petersen wrote:
> >>>>> "Dan" = Dan Carpenter <dan.carpenter@oracle.com> writes:
>
> Dan> After the loop we test for "if (!retries) " as a failure, but
> Dan> actually the post-op here will end with retries set to -1. I have
> Dan> fixed this by using a pre-op instead.
>
> Applied to 4.4/scsi-fixes.
>
The qlogic devs asked me to redo this patch but you have already applied
it. Should I resend or redo it on top of the earlier patch. (James's
tree was rebaseable for a day after a patch was "applied".)
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] qla2xxx: fix a timeout loop
2015-12-17 10:46 ` Dan Carpenter
@ 2015-12-17 16:47 ` Martin K. Petersen
0 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2015-12-17 16:47 UTC (permalink / raw)
To: Dan Carpenter
Cc: Martin K. Petersen, qla2xxx-upstream, Atul Deshmukh,
James E.J. Bottomley, linux-scsi, kernel-janitors,
Johannes Thumshirn
>>>>> "Dan" = Dan Carpenter <dan.carpenter@oracle.com> writes:
Dan> The qlogic devs asked me to redo this patch but you have already
Dan> applied it. Should I resend or redo it on top of the earlier
Dan> patch. (James's tree was rebaseable for a day after a patch was
Dan> "applied".)
I dropped it for now.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-12-17 16:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-16 11:07 [patch] qla2xxx: fix a timeout loop Dan Carpenter
2015-12-16 11:45 ` Johannes Thumshirn
2015-12-16 22:50 ` Martin K. Petersen
2015-12-17 10:46 ` Dan Carpenter
2015-12-17 16:47 ` Martin K. Petersen
2015-12-17 1:25 ` Himanshu Madhani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox