Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 23 Feb 2018 22:09:43 +0000 (14:09 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 23 Feb 2018 22:09:43 +0000 (14:09 -0800)
Pull SCSI fixes from James Bottomley:
 "These are mostly fixes for problems with merge window code.

  In addition we have one doc update (alua) and two dead code removals
  (aiclib and octogon) a spurious assignment removal (csiostor) and a
  performance improvement for storvsc involving better interrupt
  spreading and increasing the command per lun handling"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: qla4xxx: skip error recovery in case of register disconnect.
  scsi: aacraid: fix shutdown crash when init fails
  scsi: qedi: Cleanup local str variable
  scsi: qedi: Fix truncation of CHAP name and secret
  scsi: qla2xxx: Fix incorrect handle for abort IOCB
  scsi: qla2xxx: Fix double free bug after firmware timeout
  scsi: storvsc: Increase cmd_per_lun for higher speed devices
  scsi: qla2xxx: Fix a locking imbalance in qlt_24xx_handle_els()
  scsi: scsi_dh: Document alua_rtpg_queue() arguments
  scsi: Remove Makefile entry for oktagon files
  scsi: aic7xxx: remove aiclib.c
  scsi: qla2xxx: Avoid triggering undefined behavior in qla2x00_mbx_completion()
  scsi: mptfusion: Add bounds check in mptctl_hp_targetinfo()
  scsi: sym53c8xx_2: iterator underflow in sym_getsync()
  scsi: bnx2fc: Fix check in SCSI completion handler for timed out request
  scsi: csiostor: remove redundant assignment to pointer 'ln'
  scsi: ufs: Enable quirk to ignore sending WRITE_SAME command
  scsi: ibmvfc: fix misdefined reserved field in ibmvfc_fcp_rsp_info
  scsi: qla2xxx: Fix memory corruption during hba reset test
  scsi: mpt3sas: fix an out of bound write

1  2 
drivers/scsi/aacraid/linit.c
drivers/scsi/qedi/qedi_main.c
drivers/scsi/storvsc_drv.c
drivers/scsi/ufs/ufshcd.c

index b3b931ab77ebdfc2190b113489bb1bcf81edd623,b730e8edb8b3272c43ca8deab990c3e5986333ca..2664ea0df35fa1384db54c3e8f0ff270cba09148
@@@ -1037,7 -1037,7 +1037,7 @@@ static int aac_eh_bus_reset(struct scsi
                        info = &aac->hba_map[bus][cid];
                        if (bus >= AAC_MAX_BUSES || cid >= AAC_MAX_TARGETS ||
                            info->devtype != AAC_DEVTYPE_NATIVE_RAW) {
 -                              fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT;
 +                              fib->flags |= FIB_CONTEXT_FLAG_EH_RESET;
                                cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER;
                        }
                }
@@@ -1677,9 -1677,6 +1677,9 @@@ static int aac_probe_one(struct pci_de
        aac->cardtype = index;
        INIT_LIST_HEAD(&aac->entry);
  
 +      if (aac_reset_devices || reset_devices)
 +              aac->init_reset = true;
 +
        aac->fibs = kzalloc(sizeof(struct fib) * (shost->can_queue + AAC_NUM_MGT_FIB), GFP_KERNEL);
        if (!aac->fibs)
                goto out_free_host;
         *      Map in the registers from the adapter.
         */
        aac->base_size = AAC_MIN_FOOTPRINT_SIZE;
-       if ((*aac_drivers[index].init)(aac))
+       if ((*aac_drivers[index].init)(aac)) {
+               error = -ENODEV;
                goto out_unmap;
+       }
  
        if (aac->sync_mode) {
                if (aac_sync_mode)
index 029e2e69b29f8dedd43b937212a23b81a7aca3e7,8b637d1fe5a4164bdd0b3af2aaaa8d0b50a2257c..f57a94b4f0d91636590a5ea1994e2730f8d00512
@@@ -60,7 -60,7 +60,7 @@@ static int qedi_iscsi_event_cb(void *co
  {
        struct qedi_ctx *qedi;
        struct qedi_endpoint *qedi_ep;
 -      struct async_data *data;
 +      struct iscsi_eqe_data *data;
        int rval = 0;
  
        if (!context || !fw_handle) {
        QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
                  "Recv Event %d fw_handle %p\n", fw_event_code, fw_handle);
  
 -      data = (struct async_data *)fw_handle;
 +      data = (struct iscsi_eqe_data *)fw_handle;
        QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
 -                "cid=0x%x tid=0x%x err-code=0x%x fw-dbg-param=0x%x\n",
 -                 data->cid, data->itid, data->error_code,
 -                 data->fw_debug_param);
 +                "icid=0x%x conn_id=0x%x err-code=0x%x error-pdu-opcode-reserved=0x%x\n",
 +                 data->icid, data->conn_id, data->error_code,
 +                 data->error_pdu_opcode_reserved);
  
 -      qedi_ep = qedi->ep_tbl[data->cid];
 +      qedi_ep = qedi->ep_tbl[data->icid];
  
        if (!qedi_ep) {
                QEDI_WARN(&qedi->dbg_ctx,
                          "Cannot process event, ep already disconnected, cid=0x%x\n",
 -                         data->cid);
 +                         data->icid);
                WARN_ON(1);
                return -ENODEV;
        }
@@@ -339,12 -339,12 +339,12 @@@ static int qedi_init_uio(struct qedi_ct
  static int qedi_alloc_and_init_sb(struct qedi_ctx *qedi,
                                  struct qed_sb_info *sb_info, u16 sb_id)
  {
 -      struct status_block *sb_virt;
 +      struct status_block_e4 *sb_virt;
        dma_addr_t sb_phys;
        int ret;
  
        sb_virt = dma_alloc_coherent(&qedi->pdev->dev,
 -                                   sizeof(struct status_block), &sb_phys,
 +                                   sizeof(struct status_block_e4), &sb_phys,
                                     GFP_KERNEL);
        if (!sb_virt) {
                QEDI_ERR(&qedi->dbg_ctx,
@@@ -858,6 -858,7 +858,6 @@@ static int qedi_set_iscsi_pf_param(stru
  
        qedi->pf_params.iscsi_pf_params.gl_rq_pi = QEDI_PROTO_CQ_PROD_IDX;
        qedi->pf_params.iscsi_pf_params.gl_cmd_pi = 1;
 -      qedi->pf_params.iscsi_pf_params.ooo_enable = 1;
  
  err_alloc_mem:
        return rval;
@@@ -960,7 -961,7 +960,7 @@@ static bool qedi_process_completions(st
  {
        struct qedi_ctx *qedi = fp->qedi;
        struct qed_sb_info *sb_info = fp->sb_info;
 -      struct status_block *sb = sb_info->sb_virt;
 +      struct status_block_e4 *sb = sb_info->sb_virt;
        struct qedi_percpu_s *p = NULL;
        struct global_queue *que;
        u16 prod_idx;
@@@ -1016,7 -1017,7 +1016,7 @@@ static bool qedi_fp_has_work(struct qed
        struct qedi_ctx *qedi = fp->qedi;
        struct global_queue *que;
        struct qed_sb_info *sb_info = fp->sb_info;
 -      struct status_block *sb = sb_info->sb_virt;
 +      struct status_block_e4 *sb = sb_info->sb_virt;
        u16 prod_idx;
  
        barrier();
@@@ -1263,10 -1264,8 +1263,10 @@@ static int qedi_alloc_bdq(struct qedi_c
                QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_CONN,
                          "pbl [0x%p] pbl->address hi [0x%llx] lo [0x%llx], idx [%d]\n",
                          pbl, pbl->address.hi, pbl->address.lo, i);
 -              pbl->opaque.hi = 0;
 -              pbl->opaque.lo = cpu_to_le32(QEDI_U64_LO(i));
 +              pbl->opaque.iscsi_opaque.reserved_zero[0] = 0;
 +              pbl->opaque.iscsi_opaque.reserved_zero[1] = 0;
 +              pbl->opaque.iscsi_opaque.reserved_zero[2] = 0;
 +              pbl->opaque.iscsi_opaque.opaque = cpu_to_le16(i);
                pbl++;
        }
  
@@@ -1724,7 -1723,6 +1724,6 @@@ static ssize_t qedi_show_boot_eth_info(
  {
        struct qedi_ctx *qedi = data;
        struct nvm_iscsi_initiator *initiator;
-       char *str = buf;
        int rc = 1;
        u32 ipv6_en, dhcp_en, ip_len;
        struct nvm_iscsi_block *block;
  
        switch (type) {
        case ISCSI_BOOT_ETH_IP_ADDR:
-               rc = snprintf(str, ip_len, fmt, ip);
+               rc = snprintf(buf, ip_len, fmt, ip);
                break;
        case ISCSI_BOOT_ETH_SUBNET_MASK:
-               rc = snprintf(str, ip_len, fmt, sub);
+               rc = snprintf(buf, ip_len, fmt, sub);
                break;
        case ISCSI_BOOT_ETH_GATEWAY:
-               rc = snprintf(str, ip_len, fmt, gw);
+               rc = snprintf(buf, ip_len, fmt, gw);
                break;
        case ISCSI_BOOT_ETH_FLAGS:
-               rc = snprintf(str, 3, "%hhd\n",
+               rc = snprintf(buf, 3, "%hhd\n",
                              SYSFS_FLAG_FW_SEL_BOOT);
                break;
        case ISCSI_BOOT_ETH_INDEX:
-               rc = snprintf(str, 3, "0\n");
+               rc = snprintf(buf, 3, "0\n");
                break;
        case ISCSI_BOOT_ETH_MAC:
-               rc = sysfs_format_mac(str, qedi->mac, ETH_ALEN);
+               rc = sysfs_format_mac(buf, qedi->mac, ETH_ALEN);
                break;
        case ISCSI_BOOT_ETH_VLAN:
-               rc = snprintf(str, 12, "%d\n",
+               rc = snprintf(buf, 12, "%d\n",
                              GET_FIELD2(initiator->generic_cont0,
                                         NVM_ISCSI_CFG_INITIATOR_VLAN));
                break;
        case ISCSI_BOOT_ETH_ORIGIN:
                if (dhcp_en)
-                       rc = snprintf(str, 3, "3\n");
+                       rc = snprintf(buf, 3, "3\n");
                break;
        default:
                rc = 0;
@@@ -1819,7 -1817,6 +1818,6 @@@ static ssize_t qedi_show_boot_ini_info(
  {
        struct qedi_ctx *qedi = data;
        struct nvm_iscsi_initiator *initiator;
-       char *str = buf;
        int rc;
        struct nvm_iscsi_block *block;
  
  
        switch (type) {
        case ISCSI_BOOT_INI_INITIATOR_NAME:
-               rc = snprintf(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, "%s\n",
-                             initiator->initiator_name.byte);
+               rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN,
+                            initiator->initiator_name.byte);
                break;
        default:
                rc = 0;
@@@ -1860,7 -1857,6 +1858,6 @@@ static ssize_
  qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type,
                        char *buf, enum qedi_nvm_tgts idx)
  {
-       char *str = buf;
        int rc = 1;
        u32 ctrl_flags, ipv6_en, chap_en, mchap_en, ip_len;
        struct nvm_iscsi_block *block;
  
        switch (type) {
        case ISCSI_BOOT_TGT_NAME:
-               rc = snprintf(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, "%s\n",
-                             block->target[idx].target_name.byte);
+               rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN,
+                            block->target[idx].target_name.byte);
                break;
        case ISCSI_BOOT_TGT_IP_ADDR:
                if (ipv6_en)
-                       rc = snprintf(str, ip_len, "%pI6\n",
+                       rc = snprintf(buf, ip_len, "%pI6\n",
                                      block->target[idx].ipv6_addr.byte);
                else
-                       rc = snprintf(str, ip_len, "%pI4\n",
+                       rc = snprintf(buf, ip_len, "%pI4\n",
                                      block->target[idx].ipv4_addr.byte);
                break;
        case ISCSI_BOOT_TGT_PORT:
-               rc = snprintf(str, 12, "%d\n",
+               rc = snprintf(buf, 12, "%d\n",
                              GET_FIELD2(block->target[idx].generic_cont0,
                                         NVM_ISCSI_CFG_TARGET_TCP_PORT));
                break;
        case ISCSI_BOOT_TGT_LUN:
-               rc = snprintf(str, 22, "%.*d\n",
+               rc = snprintf(buf, 22, "%.*d\n",
                              block->target[idx].lun.value[1],
                              block->target[idx].lun.value[0]);
                break;
        case ISCSI_BOOT_TGT_CHAP_NAME:
-               rc = snprintf(str, NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, "%s\n",
-                             chap_name);
+               rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
+                            chap_name);
                break;
        case ISCSI_BOOT_TGT_CHAP_SECRET:
-               rc = snprintf(str, NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN, "%s\n",
-                             chap_secret);
+               rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
+                            chap_secret);
                break;
        case ISCSI_BOOT_TGT_REV_CHAP_NAME:
-               rc = snprintf(str, NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, "%s\n",
-                             mchap_name);
+               rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
+                            mchap_name);
                break;
        case ISCSI_BOOT_TGT_REV_CHAP_SECRET:
-               rc = snprintf(str, NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN, "%s\n",
-                             mchap_secret);
+               rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN,
+                            mchap_secret);
                break;
        case ISCSI_BOOT_TGT_FLAGS:
-               rc = snprintf(str, 3, "%hhd\n", SYSFS_FLAG_FW_SEL_BOOT);
+               rc = snprintf(buf, 3, "%hhd\n", SYSFS_FLAG_FW_SEL_BOOT);
                break;
        case ISCSI_BOOT_TGT_NIC_ASSOC:
-               rc = snprintf(str, 3, "0\n");
+               rc = snprintf(buf, 3, "0\n");
                break;
        default:
                rc = 0;
index 40fc7a590e81b6f9a6749dd4945a7f134e69364d,8eadb30115aaad1d3bcda70e63abe44e44794e34..6be5ab32c94fef437f552a38f79bdc36825efb98
@@@ -953,11 -953,10 +953,11 @@@ static void storvsc_handle_error(struc
                case TEST_UNIT_READY:
                        break;
                default:
 -                      set_host_byte(scmnd, DID_TARGET_FAILURE);
 +                      set_host_byte(scmnd, DID_ERROR);
                }
                break;
        case SRB_STATUS_INVALID_LUN:
 +              set_host_byte(scmnd, DID_NO_CONNECT);
                do_work = true;
                process_err_fn = storvsc_remove_lun;
                break;
@@@ -1657,7 -1656,7 +1657,7 @@@ static struct scsi_host_template scsi_d
        .eh_timed_out =         storvsc_eh_timed_out,
        .slave_alloc =          storvsc_device_alloc,
        .slave_configure =      storvsc_device_configure,
-       .cmd_per_lun =          255,
+       .cmd_per_lun =          2048,
        .this_id =              -1,
        .use_clustering =       ENABLE_CLUSTERING,
        /* Make sure we dont get a sg segment crosses a page boundary */
index a355d989b414f9059abe8e04bad9bbf6d2459c34,8196976182c9201ba380495a6e3761f0703cabfb..c7da2c185990615f906e847def5b6513a1338801
@@@ -4352,6 -4352,8 +4352,8 @@@ static int ufshcd_slave_alloc(struct sc
        /* REPORT SUPPORTED OPERATION CODES is not supported */
        sdev->no_report_opcodes = 1;
  
+       /* WRITE_SAME command is not supported */
+       sdev->no_write_same = 1;
  
        ufshcd_set_queue_depth(sdev);
  
@@@ -6559,15 -6561,12 +6561,15 @@@ static int ufshcd_config_vreg(struct de
                struct ufs_vreg *vreg, bool on)
  {
        int ret = 0;
 -      struct regulator *reg = vreg->reg;
 -      const char *name = vreg->name;
 +      struct regulator *reg;
 +      const char *name;
        int min_uV, uA_load;
  
        BUG_ON(!vreg);
  
 +      reg = vreg->reg;
 +      name = vreg->name;
 +
        if (regulator_count_voltages(reg) > 0) {
                min_uV = on ? vreg->min_uV : 0;
                ret = regulator_set_voltage(reg, min_uV, vreg->max_uV);