Skip to content

Commit 10f76dc

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Four small fixes, three in drivers. The core fix is yet another attempt to insulate us from UFS devices' weird behaviour for VPD pages" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: mpt3sas: Don't print sense pool info twice scsi: core: Improve scsi_vpd_inquiry() checks scsi: megaraid_sas: Fix crash after a double completion scsi: megaraid_sas: Fix fw_crash_buffer_show()
2 parents b2bc47e + d684a7a commit 10f76dc

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

drivers/scsi/megaraid/megaraid_sas_base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3298,7 +3298,7 @@ fw_crash_buffer_show(struct device *cdev,
32983298

32993299
spin_lock_irqsave(&instance->crashdump_lock, flags);
33003300
buff_offset = instance->fw_crash_buffer_offset;
3301-
if (!instance->crash_dump_buf &&
3301+
if (!instance->crash_dump_buf ||
33023302
!((instance->fw_crash_state == AVAILABLE) ||
33033303
(instance->fw_crash_state == COPYING))) {
33043304
dev_err(&instance->pdev->dev,

drivers/scsi/megaraid/megaraid_sas_fusion.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4771,7 +4771,7 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd)
47714771
devhandle = megasas_get_tm_devhandle(scmd->device);
47724772

47734773
if (devhandle == (u16)ULONG_MAX) {
4774-
ret = SUCCESS;
4774+
ret = FAILED;
47754775
sdev_printk(KERN_INFO, scmd->device,
47764776
"task abort issued for invalid devhandle\n");
47774777
mutex_unlock(&instance->reset_mutex);
@@ -4841,7 +4841,7 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd)
48414841
devhandle = megasas_get_tm_devhandle(scmd->device);
48424842

48434843
if (devhandle == (u16)ULONG_MAX) {
4844-
ret = SUCCESS;
4844+
ret = FAILED;
48454845
sdev_printk(KERN_INFO, scmd->device,
48464846
"target reset issued for invalid devhandle\n");
48474847
mutex_unlock(&instance->reset_mutex);

drivers/scsi/mpt3sas/mpt3sas_base.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6616,11 +6616,6 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
66166616
else if (rc == -EAGAIN)
66176617
goto try_32bit_dma;
66186618
total_sz += sense_sz;
6619-
ioc_info(ioc,
6620-
"sense pool(0x%p)- dma(0x%llx): depth(%d),"
6621-
"element_size(%d), pool_size(%d kB)\n",
6622-
ioc->sense, (unsigned long long)ioc->sense_dma, ioc->scsiio_depth,
6623-
SCSI_SENSE_BUFFERSIZE, sz / 1024);
66246619
/* reply pool, 4 byte align */
66256620
sz = ioc->reply_free_queue_depth * ioc->reply_sz;
66266621
rc = _base_allocate_reply_pool(ioc, sz);

drivers/scsi/scsi.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,18 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer,
314314
if (result)
315315
return -EIO;
316316

317-
/* Sanity check that we got the page back that we asked for */
317+
/*
318+
* Sanity check that we got the page back that we asked for and that
319+
* the page size is not 0.
320+
*/
318321
if (buffer[1] != page)
319322
return -EIO;
320323

321-
return get_unaligned_be16(&buffer[2]) + 4;
324+
result = get_unaligned_be16(&buffer[2]);
325+
if (!result)
326+
return -EIO;
327+
328+
return result + 4;
322329
}
323330

324331
static int scsi_get_vpd_size(struct scsi_device *sdev, u8 page)

0 commit comments

Comments
 (0)