public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Long Li <longli@exchange.microsoft.com>
To: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Long Li <longli@microsoft.com>
Subject: [PATCH] scsi: zero per-cmd driver data for each MQ I/O
Date: Wed, 10 May 2017 14:07:23 -0700	[thread overview]
Message-ID: <1494450443-2921-1-git-send-email-longli@exchange.microsoft.com> (raw)

From: Long Li <longli@microsoft.com>

Lower layer driver may not initialize private data before use. Zero them
out to prevent use of stale data.

Signed-off-by: Long Li <longli@microsoft.com>
---
 drivers/scsi/scsi_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 19125d7..a821593 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1850,7 +1850,7 @@ static int scsi_mq_prep_fn(struct request *req)
 
 	/* zero out the cmd, except for the embedded scsi_request */
 	memset((char *)cmd + sizeof(cmd->req), 0,
-		sizeof(*cmd) - sizeof(cmd->req));
+		sizeof(*cmd) - sizeof(cmd->req) + shost->hostt->cmd_size);
 
 	req->special = cmd;
 
-- 
2.7.4

             reply	other threads:[~2017-05-10 21:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 21:07 Long Li [this message]
2017-05-15 22:48 ` [PATCH] scsi: zero per-cmd driver data for each MQ I/O Long Li
2017-05-15 23:20   ` KY Srinivasan
2017-05-15 23:02 ` [Possible Phish Fraud][PATCH] " Bart Van Assche
2017-05-18  6:55 ` [PATCH] " Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2017-05-15 23:32 Long Li
2017-05-16  0:00 ` Bart Van Assche
2017-05-16 17:31   ` Long Li
2017-05-17 23:05     ` Bart Van Assche
2017-05-18  6:54       ` Christoph Hellwig
2017-05-18 13:29         ` KY Srinivasan
2017-05-18 15:52         ` Bart Van Assche
2017-05-18 16:47           ` Long Li

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=1494450443-2921-1-git-send-email-longli@exchange.microsoft.com \
    --to=longli@exchange.microsoft.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=martin.petersen@oracle.com \
    /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