stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix sense handling in __scsi_execute()
@ 2019-01-23 22:42 Bart Van Assche
  2019-01-24  0:03 ` Bart Van Assche
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2019-01-23 22:42 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Bart Van Assche, Christoph Hellwig, Douglas Gilbert,
	stable

Since blk_execute_rq() no longer allocates a sense buffer and no longer
initializes the sense pointer the callers of blk_execute_rq() have to do
initialize the sense pointer. Hence this patch that initializes rq->sense
and that removes a superfluous memcpy() statement.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Cc: <stable@vger.kernel.org> # v4.11+
Fixes: 82ed4db499b8 ("block: split scsi_request out of struct request")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_lib.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 4feba3b5aff1..8b9f4b1bca35 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -271,6 +271,7 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
 	rq->cmd_len = COMMAND_SIZE(cmd[0]);
 	memcpy(rq->cmd, cmd, rq->cmd_len);
 	rq->retries = retries;
+	rq->sense = sense;
 	req->timeout = timeout;
 	req->cmd_flags |= flags;
 	req->rq_flags |= rq_flags | RQF_QUIET;
@@ -291,8 +292,6 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
 
 	if (resid)
 		*resid = rq->resid_len;
-	if (sense && rq->sense_len)
-		memcpy(sense, rq->sense, SCSI_SENSE_BUFFERSIZE);
 	if (sshdr)
 		scsi_normalize_sense(rq->sense, rq->sense_len, sshdr);
 	ret = rq->result;
-- 
2.20.1.321.g9e740568ce-goog


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

* Re: [PATCH] Fix sense handling in __scsi_execute()
  2019-01-23 22:42 [PATCH] Fix sense handling in __scsi_execute() Bart Van Assche
@ 2019-01-24  0:03 ` Bart Van Assche
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Van Assche @ 2019-01-24  0:03 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Douglas Gilbert, stable

On Wed, 2019-01-23 at 14:42 -0800, Bart Van Assche wrote:
> Since blk_execute_rq() no longer allocates a sense buffer and no longer
> initializes the sense pointer the callers of blk_execute_rq() have to do
> initialize the sense pointer. Hence this patch that initializes rq->sense
> and that removes a superfluous memcpy() statement.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Douglas Gilbert <dgilbert@interlog.com>
> Cc: <stable@vger.kernel.org> # v4.11+
> Fixes: 82ed4db499b8 ("block: split scsi_request out of struct request")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/scsi/scsi_lib.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 4feba3b5aff1..8b9f4b1bca35 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -271,6 +271,7 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
>  	rq->cmd_len = COMMAND_SIZE(cmd[0]);
>  	memcpy(rq->cmd, cmd, rq->cmd_len);
>  	rq->retries = retries;
> +	rq->sense = sense;
>  	req->timeout = timeout;
>  	req->cmd_flags |= flags;
>  	req->rq_flags |= rq_flags | RQF_QUIET;
> @@ -291,8 +292,6 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
>  
>  	if (resid)
>  		*resid = rq->resid_len;
> -	if (sense && rq->sense_len)
> -		memcpy(sense, rq->sense, SCSI_SENSE_BUFFERSIZE);
>  	if (sshdr)
>  		scsi_normalize_sense(rq->sense, rq->sense_len, sshdr);
>  	ret = rq->result;

Please ignore this patch - I just realized that this is not the right way to
fix the issue I ran into.

Bart.

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

end of thread, other threads:[~2019-01-24  0:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-23 22:42 [PATCH] Fix sense handling in __scsi_execute() Bart Van Assche
2019-01-24  0:03 ` Bart Van Assche

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