Skip to content

Commit 13ebfd0

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: "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
2 parents 1ee1832 + ed6de45 commit 13ebfd0

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

drivers/s390/scsi/zfcp_fsf.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ static void zfcp_fsf_open_wka_port_handler(struct zfcp_fsf_req *req)
15831583
int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
15841584
{
15851585
struct zfcp_qdio *qdio = wka_port->adapter->qdio;
1586-
struct zfcp_fsf_req *req = NULL;
1586+
struct zfcp_fsf_req *req;
15871587
int retval = -EIO;
15881588

15891589
spin_lock_irq(&qdio->req_q_lock);
@@ -1612,7 +1612,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
16121612
zfcp_fsf_req_free(req);
16131613
out:
16141614
spin_unlock_irq(&qdio->req_q_lock);
1615-
if (req && !IS_ERR(req))
1615+
if (!retval)
16161616
zfcp_dbf_rec_run_wka("fsowp_1", wka_port, req->req_id);
16171617
return retval;
16181618
}
@@ -1638,7 +1638,7 @@ static void zfcp_fsf_close_wka_port_handler(struct zfcp_fsf_req *req)
16381638
int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
16391639
{
16401640
struct zfcp_qdio *qdio = wka_port->adapter->qdio;
1641-
struct zfcp_fsf_req *req = NULL;
1641+
struct zfcp_fsf_req *req;
16421642
int retval = -EIO;
16431643

16441644
spin_lock_irq(&qdio->req_q_lock);
@@ -1667,7 +1667,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
16671667
zfcp_fsf_req_free(req);
16681668
out:
16691669
spin_unlock_irq(&qdio->req_q_lock);
1670-
if (req && !IS_ERR(req))
1670+
if (!retval)
16711671
zfcp_dbf_rec_run_wka("fscwp_1", wka_port, req->req_id);
16721672
return retval;
16731673
}

drivers/scsi/aacraid/comminit.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,13 @@ struct aac_common aac_config = {
5050

5151
static inline int aac_is_msix_mode(struct aac_dev *dev)
5252
{
53-
u32 status;
53+
u32 status = 0;
5454

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+
}
5660
return (status & AAC_INT_MODE_MSIX);
5761
}
5862

drivers/scsi/mpt3sas/mpt3sas_scsih.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include <linux/workqueue.h>
5252
#include <linux/delay.h>
5353
#include <linux/pci.h>
54+
#include <linux/pci-aspm.h>
5455
#include <linux/interrupt.h>
5556
#include <linux/aer.h>
5657
#include <linux/raid_class.h>
@@ -4657,6 +4658,7 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
46574658
struct MPT3SAS_DEVICE *sas_device_priv_data;
46584659
u32 response_code = 0;
46594660
unsigned long flags;
4661+
unsigned int sector_sz;
46604662

46614663
mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply);
46624664
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)
47154717
}
47164718

47174719
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+
47184734
scsi_set_resid(scmd, scsi_bufflen(scmd) - xfer_cnt);
47194735
if (ioc_status & MPI2_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE)
47204736
log_info = le32_to_cpu(mpi_reply->IOCLogInfo);
@@ -8746,6 +8762,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
87468762

87478763
switch (hba_mpi_version) {
87488764
case MPI2_VERSION:
8765+
pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S |
8766+
PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
87498767
/* Use mpt2sas driver host template for SAS 2.0 HBA's */
87508768
shost = scsi_host_alloc(&mpt2sas_driver_template,
87518769
sizeof(struct MPT3SAS_ADAPTER));

drivers/scsi/qla2xxx/qla_isr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3242,7 +3242,7 @@ qla2x00_free_irqs(scsi_qla_host_t *vha)
32423242
* from a probe failure context.
32433243
*/
32443244
if (!ha->rsp_q_map || !ha->rsp_q_map[0])
3245-
return;
3245+
goto free_irqs;
32463246
rsp = ha->rsp_q_map[0];
32473247

32483248
if (ha->flags.msix_enabled) {
@@ -3262,6 +3262,7 @@ qla2x00_free_irqs(scsi_qla_host_t *vha)
32623262
free_irq(pci_irq_vector(ha->pdev, 0), rsp);
32633263
}
32643264

3265+
free_irqs:
32653266
pci_free_irq_vectors(ha->pdev);
32663267
}
32673268

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,7 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
16161616
/* Don't abort commands in adapter during EEH
16171617
* recovery as it's not accessible/responding.
16181618
*/
1619-
if (!ha->flags.eeh_busy) {
1619+
if (GET_CMD_SP(sp) && !ha->flags.eeh_busy) {
16201620
/* Get a reference to the sp and drop the lock.
16211621
* The reference ensures this sp->done() call
16221622
* - and not the call in qla2xxx_eh_abort() -

0 commit comments

Comments
 (0)