Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 511833ac authored by Alan Stern's avatar Alan Stern Committed by James Bottomley
Browse files

SCSI: fix regression in scsi_send_eh_cmnd()



Commit ac61d195 (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: default avatarAlan Stern <stern@rowland.harvard.edu>
Reported-by: default avatarАндрей Аладьев <aladjev.andrew@gmail.com>
Tested-by: default avatarАндрей Аладьев <aladjev.andrew@gmail.com>
Fixes: ac61d195
Acked-by: default avatarHannes Reinecke <hare@suse.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent efc7a288
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1041,7 +1041,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
		}
		}
		/* signal not to enter either branch of the if () below */
		/* signal not to enter either branch of the if () below */
		timeleft = 0;
		timeleft = 0;
		rtn = NEEDS_RETRY;
		rtn = FAILED;
	} else {
	} else {
		timeleft = wait_for_completion_timeout(&done, timeout);
		timeleft = wait_for_completion_timeout(&done, timeout);
		rtn = SUCCESS;
		rtn = SUCCESS;
@@ -1081,7 +1081,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
			rtn = FAILED;
			rtn = FAILED;
			break;
			break;
		}
		}
	} else if (!rtn) {
	} else if (rtn != FAILED) {
		scsi_abort_eh_cmnd(scmd);
		scsi_abort_eh_cmnd(scmd);
		rtn = FAILED;
		rtn = FAILED;
	}
	}