Commit 10f76dc3 authored by Linus Torvalds's avatar Linus Torvalds

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()
parents b2bc47e9 d684a7a2
...@@ -3298,7 +3298,7 @@ fw_crash_buffer_show(struct device *cdev, ...@@ -3298,7 +3298,7 @@ fw_crash_buffer_show(struct device *cdev,
spin_lock_irqsave(&instance->crashdump_lock, flags); spin_lock_irqsave(&instance->crashdump_lock, flags);
buff_offset = instance->fw_crash_buffer_offset; buff_offset = instance->fw_crash_buffer_offset;
if (!instance->crash_dump_buf && if (!instance->crash_dump_buf ||
!((instance->fw_crash_state == AVAILABLE) || !((instance->fw_crash_state == AVAILABLE) ||
(instance->fw_crash_state == COPYING))) { (instance->fw_crash_state == COPYING))) {
dev_err(&instance->pdev->dev, dev_err(&instance->pdev->dev,
......
...@@ -4771,7 +4771,7 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd) ...@@ -4771,7 +4771,7 @@ int megasas_task_abort_fusion(struct scsi_cmnd *scmd)
devhandle = megasas_get_tm_devhandle(scmd->device); devhandle = megasas_get_tm_devhandle(scmd->device);
if (devhandle == (u16)ULONG_MAX) { if (devhandle == (u16)ULONG_MAX) {
ret = SUCCESS; ret = FAILED;
sdev_printk(KERN_INFO, scmd->device, sdev_printk(KERN_INFO, scmd->device,
"task abort issued for invalid devhandle\n"); "task abort issued for invalid devhandle\n");
mutex_unlock(&instance->reset_mutex); mutex_unlock(&instance->reset_mutex);
...@@ -4841,7 +4841,7 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd) ...@@ -4841,7 +4841,7 @@ int megasas_reset_target_fusion(struct scsi_cmnd *scmd)
devhandle = megasas_get_tm_devhandle(scmd->device); devhandle = megasas_get_tm_devhandle(scmd->device);
if (devhandle == (u16)ULONG_MAX) { if (devhandle == (u16)ULONG_MAX) {
ret = SUCCESS; ret = FAILED;
sdev_printk(KERN_INFO, scmd->device, sdev_printk(KERN_INFO, scmd->device,
"target reset issued for invalid devhandle\n"); "target reset issued for invalid devhandle\n");
mutex_unlock(&instance->reset_mutex); mutex_unlock(&instance->reset_mutex);
......
...@@ -6616,11 +6616,6 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -6616,11 +6616,6 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
else if (rc == -EAGAIN) else if (rc == -EAGAIN)
goto try_32bit_dma; goto try_32bit_dma;
total_sz += sense_sz; total_sz += sense_sz;
ioc_info(ioc,
"sense pool(0x%p)- dma(0x%llx): depth(%d),"
"element_size(%d), pool_size(%d kB)\n",
ioc->sense, (unsigned long long)ioc->sense_dma, ioc->scsiio_depth,
SCSI_SENSE_BUFFERSIZE, sz / 1024);
/* reply pool, 4 byte align */ /* reply pool, 4 byte align */
sz = ioc->reply_free_queue_depth * ioc->reply_sz; sz = ioc->reply_free_queue_depth * ioc->reply_sz;
rc = _base_allocate_reply_pool(ioc, sz); rc = _base_allocate_reply_pool(ioc, sz);
......
...@@ -314,11 +314,18 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer, ...@@ -314,11 +314,18 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer,
if (result) if (result)
return -EIO; return -EIO;
/* Sanity check that we got the page back that we asked for */ /*
* Sanity check that we got the page back that we asked for and that
* the page size is not 0.
*/
if (buffer[1] != page) if (buffer[1] != page)
return -EIO; return -EIO;
return get_unaligned_be16(&buffer[2]) + 4; result = get_unaligned_be16(&buffer[2]);
if (!result)
return -EIO;
return result + 4;
} }
static int scsi_get_vpd_size(struct scsi_device *sdev, u8 page) static int scsi_get_vpd_size(struct scsi_device *sdev, u8 page)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment