linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] SCSI: fix regression in scsi_send_eh_cmnd()
@ 2014-11-21 15:44 Alan Stern
  2014-11-21 15:57 ` Hannes Reinecke
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Stern @ 2014-11-21 15:44 UTC (permalink / raw)
  To: James Bottomley
  Cc: Андрей Аладьев,
	Hannes Reinecke, SCSI development list, USB list

Commit ac61d1955934 (scsi: set correct completion code in
scsi_send_eh_cmnd()) introduced a bug.  It changed the stored return
value from a queuecommand call, but it didn't take into account that
the return value was used again later on.  This patch fixes the bug by
changing the later usage.

There is a big comment in the middle of scsi_send_eh_cmnd() which
does a good job of explaining how the routine works.  But it mentions
a "rtn = FAILURE" value that doesn't exist in the code.  This patch
adjusts the code to match the comment (I assume the comment is right
and the code is wrong).

This fixes Bugzilla #88341.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Андрей Аладьев <aladjev.andrew@gmail.com>
Tested-by: Андрей Аладьев <aladjev.andrew@gmail.com>
Fixes: ac61d19559349e205dad7b5122b281419aa74a82
CC: Hannes Reinecke <hare@suse.de>
CC: <stable@vger.kernel.org>

---


[as1768]


 drivers/scsi/scsi_error.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: 3.18-rc5/drivers/scsi/scsi_error.c
===================================================================
--- 3.18-rc5.orig/drivers/scsi/scsi_error.c
+++ 3.18-rc5/drivers/scsi/scsi_error.c
@@ -1027,7 +1027,7 @@ retry:
 		}
 		/* signal not to enter either branch of the if () below */
 		timeleft = 0;
-		rtn = NEEDS_RETRY;
+		rtn = FAILED;
 	} else {
 		timeleft = wait_for_completion_timeout(&done, timeout);
 		rtn = SUCCESS;
@@ -1067,7 +1067,7 @@ retry:
 			rtn = FAILED;
 			break;
 		}
-	} else if (!rtn) {
+	} else if (rtn != FAILED) {
 		scsi_abort_eh_cmnd(scmd);
 		rtn = FAILED;
 	}

--
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] SCSI: fix regression in scsi_send_eh_cmnd()
  2014-11-21 15:44 [PATCH] SCSI: fix regression in scsi_send_eh_cmnd() Alan Stern
@ 2014-11-21 15:57 ` Hannes Reinecke
  0 siblings, 0 replies; 2+ messages in thread
From: Hannes Reinecke @ 2014-11-21 15:57 UTC (permalink / raw)
  To: Alan Stern, James Bottomley
  Cc: Андрей Аладьев,
	SCSI development list, USB list

On 11/21/2014 04:44 PM, Alan Stern wrote:
> Commit ac61d1955934 (scsi: set correct completion code in
> scsi_send_eh_cmnd()) introduced a bug.  It changed the stored return
> value from a queuecommand call, but it didn't take into account that
> the return value was used again later on.  This patch fixes the bug by
> changing the later usage.
> 
> There is a big comment in the middle of scsi_send_eh_cmnd() which
> does a good job of explaining how the routine works.  But it mentions
> a "rtn = FAILURE" value that doesn't exist in the code.  This patch
> adjusts the code to match the comment (I assume the comment is right
> and the code is wrong).
> 
> This fixes Bugzilla #88341.
> 
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> Reported-by: Андрей Аладьев <aladjev.andrew@gmail.com>
> Tested-by: Андрей Аладьев <aladjev.andrew@gmail.com>
> Fixes: ac61d19559349e205dad7b5122b281419aa74a82
> CC: Hannes Reinecke <hare@suse.de>
> CC: <stable@vger.kernel.org>
> 
That is correct.

Acked-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 21284 (AG Nürnberg)
--
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-21 15:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-21 15:44 [PATCH] SCSI: fix regression in scsi_send_eh_cmnd() Alan Stern
2014-11-21 15:57 ` Hannes Reinecke

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).