aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-11 12:01:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-11 12:01:03 -0500
commit13ebfd0601228fbbd92707ce4944ab1a09a4d821 (patch)
tree10efe652d9e1cda881d1ca57cfc81039a854bde1
parent1ee18329fae936089c6c599250ae92482ff2b81f (diff)
parented6de4560ad2f7578be3a9ca1364e268c641f3a7 (diff)
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Six fairly small fixes. None is a real show stopper, two automation detected problems: one memory leak, one use after free and four others each of which fixes something that has been a significant source of annoyance to someone" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: zfcp: fix use-after-free by not tracing WKA port open/close on failed send scsi: aacraid: Fix INTx/MSI-x issue with older controllers scsi: mpt3sas: disable ASPM for MPI2 controllers scsi: mpt3sas: Force request partial completion alignment scsi: qla2xxx: Avoid that issuing a LIP triggers a kernel crash scsi: qla2xxx: Fix a recently introduced memory leak
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c8
-rw-r--r--drivers/scsi/aacraid/comminit.c8
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_scsih.c18
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c3
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c2
5 files changed, 31 insertions, 8 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 75f820ca17b7..27ff38f839fc 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -1583,7 +1583,7 @@ out:
1583int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port) 1583int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
1584{ 1584{
1585 struct zfcp_qdio *qdio = wka_port->adapter->qdio; 1585 struct zfcp_qdio *qdio = wka_port->adapter->qdio;
1586 struct zfcp_fsf_req *req = NULL; 1586 struct zfcp_fsf_req *req;
1587 int retval = -EIO; 1587 int retval = -EIO;
1588 1588
1589 spin_lock_irq(&qdio->req_q_lock); 1589 spin_lock_irq(&qdio->req_q_lock);
@@ -1612,7 +1612,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
1612 zfcp_fsf_req_free(req); 1612 zfcp_fsf_req_free(req);
1613out: 1613out:
1614 spin_unlock_irq(&qdio->req_q_lock); 1614 spin_unlock_irq(&qdio->req_q_lock);
1615 if (req && !IS_ERR(req)) 1615 if (!retval)
1616 zfcp_dbf_rec_run_wka("fsowp_1", wka_port, req->req_id); 1616 zfcp_dbf_rec_run_wka("fsowp_1", wka_port, req->req_id);
1617 return retval; 1617 return retval;
1618} 1618}
@@ -1638,7 +1638,7 @@ static void zfcp_fsf_close_wka_port_handler(struct zfcp_fsf_req *req)
1638int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port) 1638int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
1639{ 1639{
1640 struct zfcp_qdio *qdio = wka_port->adapter->qdio; 1640 struct zfcp_qdio *qdio = wka_port->adapter->qdio;
1641 struct zfcp_fsf_req *req = NULL; 1641 struct zfcp_fsf_req *req;
1642 int retval = -EIO; 1642 int retval = -EIO;
1643 1643
1644 spin_lock_irq(&qdio->req_q_lock); 1644 spin_lock_irq(&qdio->req_q_lock);
@@ -1667,7 +1667,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
1667 zfcp_fsf_req_free(req); 1667 zfcp_fsf_req_free(req);
1668out: 1668out:
1669 spin_unlock_irq(&qdio->req_q_lock); 1669 spin_unlock_irq(&qdio->req_q_lock);
1670 if (req && !IS_ERR(req)) 1670 if (!retval)
1671 zfcp_dbf_rec_run_wka("fscwp_1", wka_port, req->req_id); 1671 zfcp_dbf_rec_run_wka("fscwp_1", wka_port, req->req_id);
1672 return retval; 1672 return retval;
1673} 1673}
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 4f56b1003cc7..5b48bedd7c38 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -50,9 +50,13 @@ struct aac_common aac_config = {
50 50
51static inline int aac_is_msix_mode(struct aac_dev *dev) 51static inline int aac_is_msix_mode(struct aac_dev *dev)
52{ 52{
53 u32 status; 53 u32 status = 0;
54 54
55 status = src_readl(dev, MUnit.OMR); 55 if (dev->pdev->device == PMC_DEVICE_S6 ||
56 dev->pdev->device == PMC_DEVICE_S7 ||
57 dev->pdev->device == PMC_DEVICE_S8) {
58 status = src_readl(dev, MUnit.OMR);
59 }
56 return (status & AAC_INT_MODE_MSIX); 60 return (status & AAC_INT_MODE_MSIX);
57} 61}
58 62
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 75f3fce1c867..0b5b423b1db0 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -51,6 +51,7 @@
51#include <linux/workqueue.h> 51#include <linux/workqueue.h>
52#include <linux/delay.h> 52#include <linux/delay.h>
53#include <linux/pci.h> 53#include <linux/pci.h>
54#include <linux/pci-aspm.h>
54#include <linux/interrupt.h> 55#include <linux/interrupt.h>
55#include <linux/aer.h> 56#include <linux/aer.h>
56#include <linux/raid_class.h> 57#include <linux/raid_class.h>
@@ -4657,6 +4658,7 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
4657 struct MPT3SAS_DEVICE *sas_device_priv_data; 4658 struct MPT3SAS_DEVICE *sas_device_priv_data;
4658 u32 response_code = 0; 4659 u32 response_code = 0;
4659 unsigned long flags; 4660 unsigned long flags;
4661 unsigned int sector_sz;
4660 4662
4661 mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply); 4663 mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply);
4662 scmd = _scsih_scsi_lookup_get_clear(ioc, smid); 4664 scmd = _scsih_scsi_lookup_get_clear(ioc, smid);
@@ -4715,6 +4717,20 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
4715 } 4717 }
4716 4718
4717 xfer_cnt = le32_to_cpu(mpi_reply->TransferCount); 4719 xfer_cnt = le32_to_cpu(mpi_reply->TransferCount);
4720
4721 /* In case of bogus fw or device, we could end up having
4722 * unaligned partial completion. We can force alignment here,
4723 * then scsi-ml does not need to handle this misbehavior.
4724 */
4725 sector_sz = scmd->device->sector_size;
4726 if (unlikely(scmd->request->cmd_type == REQ_TYPE_FS && sector_sz &&
4727 xfer_cnt % sector_sz)) {
4728 sdev_printk(KERN_INFO, scmd->device,
4729 "unaligned partial completion avoided (xfer_cnt=%u, sector_sz=%u)\n",
4730 xfer_cnt, sector_sz);
4731 xfer_cnt = round_down(xfer_cnt, sector_sz);
4732 }
4733
4718 scsi_set_resid(scmd, scsi_bufflen(scmd) - xfer_cnt); 4734 scsi_set_resid(scmd, scsi_bufflen(scmd) - xfer_cnt);
4719 if (ioc_status & MPI2_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) 4735 if (ioc_status & MPI2_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE)
4720 log_info = le32_to_cpu(mpi_reply->IOCLogInfo); 4736 log_info = le32_to_cpu(mpi_reply->IOCLogInfo);
@@ -8746,6 +8762,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
8746 8762
8747 switch (hba_mpi_version) { 8763 switch (hba_mpi_version) {
8748 case MPI2_VERSION: 8764 case MPI2_VERSION:
8765 pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S |
8766 PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
8749 /* Use mpt2sas driver host template for SAS 2.0 HBA's */ 8767 /* Use mpt2sas driver host template for SAS 2.0 HBA's */
8750 shost = scsi_host_alloc(&mpt2sas_driver_template, 8768 shost = scsi_host_alloc(&mpt2sas_driver_template,
8751 sizeof(struct MPT3SAS_ADAPTER)); 8769 sizeof(struct MPT3SAS_ADAPTER));
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index dc88a09f9043..a94b0b6bd030 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -3242,7 +3242,7 @@ qla2x00_free_irqs(scsi_qla_host_t *vha)
3242 * from a probe failure context. 3242 * from a probe failure context.
3243 */ 3243 */
3244 if (!ha->rsp_q_map || !ha->rsp_q_map[0]) 3244 if (!ha->rsp_q_map || !ha->rsp_q_map[0])
3245 return; 3245 goto free_irqs;
3246 rsp = ha->rsp_q_map[0]; 3246 rsp = ha->rsp_q_map[0];
3247 3247
3248 if (ha->flags.msix_enabled) { 3248 if (ha->flags.msix_enabled) {
@@ -3262,6 +3262,7 @@ qla2x00_free_irqs(scsi_qla_host_t *vha)
3262 free_irq(pci_irq_vector(ha->pdev, 0), rsp); 3262 free_irq(pci_irq_vector(ha->pdev, 0), rsp);
3263 } 3263 }
3264 3264
3265free_irqs:
3265 pci_free_irq_vectors(ha->pdev); 3266 pci_free_irq_vectors(ha->pdev);
3266} 3267}
3267 3268
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 0a000ecf0881..40660461a4b5 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1616,7 +1616,7 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
1616 /* Don't abort commands in adapter during EEH 1616 /* Don't abort commands in adapter during EEH
1617 * recovery as it's not accessible/responding. 1617 * recovery as it's not accessible/responding.
1618 */ 1618 */
1619 if (!ha->flags.eeh_busy) { 1619 if (GET_CMD_SP(sp) && !ha->flags.eeh_busy) {
1620 /* Get a reference to the sp and drop the lock. 1620 /* Get a reference to the sp and drop the lock.
1621 * The reference ensures this sp->done() call 1621 * The reference ensures this sp->done() call
1622 * - and not the call in qla2xxx_eh_abort() - 1622 * - and not the call in qla2xxx_eh_abort() -