SCSI fixes for 4.13-rc4
Subsystems (7)
James Bottomley
maintainerTwo small fixes, one re-fix of a previous fix and five patches sorting out hotplug in the bnx2X class of drivers. The latter is rather involved, but necessary because these drivers have started dropping lockdep recursion warnings on the hotplug lock because of its conversion to a percpu rwsem.
The patch is available here:
git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes
The short changelog is:
Dan Carpenter (1):
scsi: aacraid: reading out of bounds
Johannes Thumshirn (1):
scsi: sg: only check for dxfer_len greater than 256M
Thomas Bogendoerfer (1):
scsi: qedf: Limit number of CQs
Thomas Gleixner (5):
scsi: bnx2i: Simplify cpu hotplug code
scsi: bnx2fc: Simplify CPU hotplug code
scsi: bnx2i: Prevent recursive cpuhotplug locking
scsi: bnx2fc: Prevent recursive cpuhotplug locking
scsi: bnx2fc: Plug CPU hotplug race
And the diffstat:
drivers/scsi/aacraid/aachba.c | 7 ++-- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 68 +++++++++------------------------------ drivers/scsi/bnx2fc/bnx2fc_hwi.c | 45 +++++++++++++------------- drivers/scsi/bnx2i/bnx2i_init.c | 64 +++++++++--------------------------- drivers/scsi/qedf/qedf.h | 3 +- drivers/scsi/qedf/qedf_main.c | 20 ++++++------ drivers/scsi/sg.c | 31 +----------------- include/linux/cpuhotplug.h | 2 --
8 files changed, 69 insertions(+), 171 deletions(-)
With full diff below.
James
---
drivers/scsi/aacraid/aachba.c +4 -3
@@ -3198,10 +3198,11 @@ static int query_disk(struct aac_dev *dev, void __user *arg)return -EBUSY ;if (copy_from_user (&qd, arg,sizeof (struct aac_query_disk )))return -EFAULT ; -if (qd.cnum ==-1 ) +if (qd.cnum ==-1 ) { +if (qd.id <0 || qd.id >= dev->maximum_num_containers) +return -EINVAL ; qd.cnum = qd.id; -else if ((qd.bus ==-1 ) && (qd.id ==-1 ) && (qd.lun ==-1 )) - { + }else if ((qd.bus ==-1 ) && (qd.id ==-1 ) && (qd.lun ==-1 )) {if (qd.cnum <0 || qd.cnum >= dev->maximum_num_containers)return -EINVAL ; qd.instance = dev->scsi_host_ptr->host_no;
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +15 -53
122 lines not on this page · raw message
drivers/scsi/bnx2fc/bnx2fc_hwi.c +23 -22
57 lines not on this page · raw message
drivers/scsi/bnx2i/bnx2i_init.c +15 -49
110 lines not on this page · raw message
drivers/scsi/qedf/qedf.h +2 -1
@@ -528,7 +528,8 @@ struct fip_vlan {#define QEDF_WRITE (1 << 0)#define MAX_FIBRE_LUNS 0xffffffff -#define QEDF_MAX_NUM_CQS 8 +#define MIN_NUM_CPUS_MSIX (x) min_t(u32, x->dev_info.num_cqs, \ + num_online_cpus())/* * PCI function probe defines
drivers/scsi/qedf/qedf_main.c +9 -11
@@ -2760,11 +2760,9 @@ static int qedf_set_fcoe_pf_param(struct qedf_ctx *qedf)* we allocation is the minimum off: * * Number of CPUs -* Number of MSI-X vectors -* Max number allocated in hardware (QEDF_MAX_NUM_CQS) +* Number allocated by qed for our PCI function */ - qedf->num_queues =min ((unsigned int )QEDF_MAX_NUM_CQS , -num_online_cpus ()); + qedf->num_queues =MIN_NUM_CPUS_MSIX (qedf);QEDF_INFO (&(qedf->dbg_ctx),QEDF_LOG_DISC ,"Number of CQs is %d.\n" , qedf->num_queues);
@@ -2962,6 +2960,13 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) goto err1; } +/* Learn information crucial for qedf to progress */ + rc = qed_ops->fill_dev_info (qedf->cdev, &qedf->dev_info); +if (rc) { +QEDF_ERR (&(qedf->dbg_ctx),"Failed to dev info.\n" ); + goto err1; + } +/* queue allocation code should come here * order should be * slowpath_start
@@ -2977,13 +2982,6 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) } qed_ops->common->update_pf_params (qedf->cdev, &qedf->pf_params); -/* Learn information crucial for qedf to progress */ - rc = qed_ops->fill_dev_info (qedf->cdev, &qedf->dev_info); -if (rc) { -QEDF_ERR (&(qedf->dbg_ctx),"Failed to dev info.\n" ); - goto err1; - } -/* Record BDQ producer doorbell addresses */ qedf->bdq_primary_prod = qedf->dev_info.primary_dbq_rq_addr; qedf->bdq_secondary_prod = qedf->dev_info.secondary_bdq_rq_addr;
drivers/scsi/sg.c +1 -30
@@ -751,35 +751,6 @@ sg_new_write(Sg_fd *sfp, struct file *file, const char __user *buf,return count; } -static bool sg_is_valid_dxfer (sg_io_hdr_t *hp) -{ -switch (hp->dxfer_direction) { -case SG_DXFER_NONE : -if (hp->dxferp || hp->dxfer_len >0 ) -return false; -return true; -case SG_DXFER_FROM_DEV : -/* -* for SG_DXFER_FROM_DEV we always set dxfer_len to > 0. dxferp -* can either be NULL or != NULL so there's no point in checking -* it either. So just return true. -*/ -return true; -case SG_DXFER_TO_DEV : -case SG_DXFER_TO_FROM_DEV : -if (!hp->dxferp || hp->dxfer_len ==0 ) -return false; -return true; -case SG_DXFER_UNKNOWN : -if ((!hp->dxferp && hp->dxfer_len) || - (hp->dxferp && hp->dxfer_len ==0 )) -return false; -return true; -default : -return false; - } -} -static int sg_common_write (Sg_fd * sfp,Sg_request * srp,unsigned char *cmnd,int timeout,int blocking)
@@ -800,7 +771,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,"sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n" , (int) cmnd[0], (int) hp->cmd_len)); -if (!sg_is_valid_dxfer (hp)) +if (hp->dxfer_len >=SZ_256M )return -EINVAL ; k =sg_start_req (srp, cmnd);
include/linux/cpuhotplug.h +0 -2
@@ -39,8 +39,6 @@ enum cpuhp_state {CPUHP_PCI_XGENE_DEAD ,CPUHP_IOMMU_INTEL_DEAD ,CPUHP_LUSTRE_CFS_DEAD , -CPUHP_SCSI_BNX2FC_DEAD , -CPUHP_SCSI_BNX2I_DEAD ,CPUHP_WORKQUEUE_PREP ,CPUHP_POWER_NUMA_PREPARE , CPUHP_HRTIMERS_PREPARE,