All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saurav Kashyap <skashyap@marvell.com>
To: <martin.petersen@oracle.com>
Cc: <gbasrur@marvell.com>, <svernekar@marvell.com>,
	<linux-scsi@vger.kernel.org>
Subject: [PATCH 03/14] qedf: Fix crash during sg_reset.
Date: Fri, 23 Aug 2019 02:52:33 -0700	[thread overview]
Message-ID: <20190823095244.7830-4-skashyap@marvell.com> (raw)
In-Reply-To: <20190823095244.7830-1-skashyap@marvell.com>

From: Arun Easi <aeasi@marvell.com>

Driver was attempting to print cdb[0], which is not set for resets
coming from SCSI ioctls. Check for cmd_len before accessing cmnd.

Crash info:
[84790.864747] BUG: unable to handle kernel NULL pointer dereference at (null)
[84790.864783] IP: qedf_initiate_tmf+0x7a/0x6e0 [qedf]
[84790.865204] Call Trace:
[84790.865246]  scsi_try_target_reset+0x2b/0x90 [scsi_mod]
[84790.865266]  scsi_ioctl_reset+0x20f/0x2a0 [scsi_mod]
[84790.865284]  scsi_ioctl+0x131/0x3a0 [scsi_mod]

Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
---
 drivers/scsi/qedf/qedf_io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c
index 5b42892..7377a53 100644
--- a/drivers/scsi/qedf/qedf_io.c
+++ b/drivers/scsi/qedf/qedf_io.c
@@ -2403,8 +2403,8 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags)
 
 	QEDF_ERR(NULL,
 		 "tm_flags 0x%x sc_cmd %p op = 0x%02x target_id = 0x%x lun=%d\n",
-		 tm_flags, sc_cmd, sc_cmd->cmnd[0], rport->scsi_target_id,
-		 (int)sc_cmd->device->lun);
+		 tm_flags, sc_cmd, sc_cmd->cmd_len ? sc_cmd->cmnd[0] : 0xff,
+		 rport->scsi_target_id, (int)sc_cmd->device->lun);
 
 	if (!rdata || !kref_get_unless_zero(&rdata->kref)) {
 		QEDF_ERR(NULL, "stale rport\n");
-- 
1.8.3.1


  parent reply	other threads:[~2019-08-23  9:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23  9:52 [PATCH 00/14] qedf: Miscellaneous fixes Saurav Kashyap
2019-08-23  9:52 ` [PATCH 01/14] qedf: Print message during bailout conditions Saurav Kashyap
2019-08-23  9:52 ` [PATCH 02/14] qedf: Stop sending fipvlan request on unload Saurav Kashyap
2019-08-23  9:52 ` Saurav Kashyap [this message]
2019-08-23  9:52 ` [PATCH 04/14] qedf: Update module description string Saurav Kashyap
2019-08-23  9:52 ` [PATCH 05/14] qedf: Add shutdown callback handler Saurav Kashyap
2019-08-23  9:52 ` [PATCH 06/14] qedf: Interpret supported caps value correctly Saurav Kashyap
2019-08-23  9:52 ` [PATCH 07/14] qedf: Add support for 20 Gbps speed Saurav Kashyap
2019-08-23  9:52 ` [PATCH 08/14] qedf: Add debug information for unsolicited processing Saurav Kashyap
2019-08-23  9:52 ` [PATCH 09/14] qedf: Initiator fails to re-login to switch after link down Saurav Kashyap
2019-08-23  9:52 ` [PATCH 10/14] qedf: Check for module unloading bit before processing link update AEN Saurav Kashyap
2019-08-23  9:52 ` [PATCH 11/14] qedf: Decrease the LL2 MTU size to 2500 Saurav Kashyap
2019-08-23  9:52 ` [PATCH 12/14] qedf: Use discovery list to traverse rports Saurav Kashyap
2019-08-23  9:52 ` [PATCH 13/14] qedf: Fix race betwen fipvlan request and response path Saurav Kashyap
2019-08-23  9:52 ` [PATCH 14/14] qedf: Update the version to 8.42.3.0 Saurav Kashyap
2019-08-29 22:52 ` [PATCH 00/14] qedf: Miscellaneous fixes Martin K. Petersen
2019-08-30  6:43   ` Saurav Kashyap

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=20190823095244.7830-4-skashyap@marvell.com \
    --to=skashyap@marvell.com \
    --cc=gbasrur@marvell.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=svernekar@marvell.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.