All of lore.kernel.org
 help / color / mirror / Atom feed
From: <balsundar.p@microsemi.com>
To: <linux-scsi@vger.kernel.org>, <jejb@linux.vnet.ibm.com>
Cc: <aacraid@microsemi.com>
Subject: [PATCH 1/7] scsi: aacraid: fix illegal IO beyond last LBA
Date: Tue, 15 Oct 2019 11:51:58 +0530	[thread overview]
Message-ID: <1571120524-6037-2-git-send-email-balsundar.p@microsemi.com> (raw)
In-Reply-To: <1571120524-6037-1-git-send-email-balsundar.p@microsemi.com>

From: Balsundar P <balsundar.p@microsemi.com>

The driver fails to handle data when read or written beyond device
reported LBA, which triggers kernel panic

Signed-off-by: Balsundar P <balsundar.p@microsemi.com>
---
 drivers/scsi/aacraid/aachba.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 0ed3f806ace5..2388143d59f5 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -2467,13 +2467,13 @@ static int aac_read(struct scsi_cmnd * scsicmd)
 		scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 |
 			SAM_STAT_CHECK_CONDITION;
 		set_sense(&dev->fsa_dev[cid].sense_data,
-			  HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE,
+			  ILLEGAL_REQUEST, SENCODE_LBA_OUT_OF_RANGE,
 			  ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0);
 		memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
 		       min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
 			     SCSI_SENSE_BUFFERSIZE));
 		scsicmd->scsi_done(scsicmd);
-		return 1;
+		return 0;
 	}
 
 	dprintk((KERN_DEBUG "aac_read[cpu %d]: lba = %llu, t = %ld.\n",
@@ -2559,13 +2559,13 @@ static int aac_write(struct scsi_cmnd * scsicmd)
 		scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 |
 			SAM_STAT_CHECK_CONDITION;
 		set_sense(&dev->fsa_dev[cid].sense_data,
-			  HARDWARE_ERROR, SENCODE_INTERNAL_TARGET_FAILURE,
+			  ILLEGAL_REQUEST, SENCODE_LBA_OUT_OF_RANGE,
 			  ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0);
 		memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
 		       min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
 			     SCSI_SENSE_BUFFERSIZE));
 		scsicmd->scsi_done(scsicmd);
-		return 1;
+		return 0;
 	}
 
 	dprintk((KERN_DEBUG "aac_write[cpu %d]: lba = %llu, t = %ld.\n",
-- 
2.18.1


  reply	other threads:[~2019-10-15  6:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15  6:21 [PATCH 0/7] scsi: aacraid updates balsundar.p
2019-10-15  6:21 ` balsundar.p [this message]
2019-10-15  6:21 ` [PATCH 2/7] scsi: aacraid: fixed IO reporting error balsundar.p
2019-10-15  6:22 ` [PATCH 3/7] scsi: aacraid: fixed firmware assert issue balsundar.p
2019-10-15  6:22 ` [PATCH 4/7] scsi: aacraid: setting different timeout for src and thor balsundar.p
2019-10-15  6:22 ` [PATCH 5/7] scsi: aacraid: check adapter health balsundar.p
2019-10-15  6:22 ` [PATCH 6/7] scsi: aacraid: send AIF request post IOP RESET balsundar.p
2019-10-15 18:58   ` kbuild test robot
2019-10-15 18:58     ` kbuild test robot
2019-10-15 18:58   ` [RFC PATCH] scsi: aacraid: aac_schedule_bus_scan() can be static kbuild test robot
2019-10-15 18:58     ` kbuild test robot
2019-10-18  7:26     ` Balsundar.P
2019-10-18  7:26       ` Balsundar.P
2019-10-15  6:22 ` [PATCH 7/7] scsi: aacraid: bump version balsundar.p
2019-10-18 23:35 ` [PATCH 0/7] scsi: aacraid updates Martin K. Petersen

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=1571120524-6037-2-git-send-email-balsundar.p@microsemi.com \
    --to=balsundar.p@microsemi.com \
    --cc=aacraid@microsemi.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    /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.