[bug report] scsi: qla2xxx: Fix N2N stuck connection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Quinn Tran,

Commit 881eb861ca38 ("scsi: qla2xxx: Fix N2N stuck connection") from
Feb 27, 2024 (linux-next), leads to the following Smatch static
checker warning:

	drivers/scsi/qla2xxx/qla_iocb.c:3060 qla24xx_els_dcmd2_iocb()
	warn: missing error code here? 'qla2x00_get_sp()' failed

drivers/scsi/qla2xxx/qla_iocb.c
    3043 int
    3044 qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,
    3045                         fc_port_t *fcport)
    3046 {
    3047         srb_t *sp;
    3048         struct srb_iocb *elsio = NULL;
    3049         struct qla_hw_data *ha = vha->hw;
    3050         int rval = QLA_SUCCESS;
                 ^^^^^^^^^^^^^^^^^^^^^^^

    3051         void        *ptr, *resp_ptr;
    3052 
    3053         /* Alloc SRB structure
    3054          * ref: INIT
    3055          */
    3056         sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL);
    3057         if (!sp) {
    3058                 ql_log(ql_log_info, vha, 0x70e6,
    3059                  "SRB allocation failed\n");
--> 3060                 goto done;

This used to return -ENOMEM;  Should it return QLA_FUNCTION_FAILED?

    3061         }
    3062 
    3063         fcport->flags |= FCF_ASYNC_SENT;
    3064         qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_PEND);
    3065         elsio = &sp->u.iocb_cmd;
    3066         ql_dbg(ql_dbg_io, vha, 0x3073,
    3067                "%s Enter: PLOGI portid=%06x\n", __func__, fcport->d_id.b24);
    3068 
    3069         sp->type = SRB_ELS_DCMD;
    3070         sp->name = "ELS_DCMD";
    3071         sp->fcport = fcport;
    3072         qla2x00_init_async_sp(sp, ELS_DCMD_TIMEOUT + 2,
    3073                              qla2x00_els_dcmd2_sp_done);
    3074         sp->u.iocb_cmd.timeout = qla2x00_els_dcmd2_iocb_timeout;
    3075 
    3076         elsio->u.els_plogi.tx_size = elsio->u.els_plogi.rx_size = DMA_POOL_SIZE;
    3077 
    3078         ptr = elsio->u.els_plogi.els_plogi_pyld =
    3079             dma_alloc_coherent(&ha->pdev->dev, elsio->u.els_plogi.tx_size,
    3080                 &elsio->u.els_plogi.els_plogi_pyld_dma, GFP_KERNEL);
    3081 
    3082         if (!elsio->u.els_plogi.els_plogi_pyld) {
    3083                 rval = QLA_FUNCTION_FAILED;
    3084                 goto done_free_sp;
    3085         }
    3086 
    3087         resp_ptr = elsio->u.els_plogi.els_resp_pyld =
    3088             dma_alloc_coherent(&ha->pdev->dev, elsio->u.els_plogi.rx_size,
    3089                 &elsio->u.els_plogi.els_resp_pyld_dma, GFP_KERNEL);
    3090 
    3091         if (!elsio->u.els_plogi.els_resp_pyld) {
    3092                 rval = QLA_FUNCTION_FAILED;
    3093                 goto done_free_sp;
    3094         }
    3095 
    3096         ql_dbg(ql_dbg_io, vha, 0x3073, "PLOGI %p %p\n", ptr, resp_ptr);
    3097 
    3098         memset(ptr, 0, sizeof(struct els_plogi_payload));
    3099         memset(resp_ptr, 0, sizeof(struct els_plogi_payload));
    3100         memcpy(elsio->u.els_plogi.els_plogi_pyld->data,
    3101                (void *)&ha->plogi_els_payld + offsetof(struct fc_els_flogi, fl_csp),
    3102                sizeof(ha->plogi_els_payld) - offsetof(struct fc_els_flogi, fl_csp));
    3103 
    3104         elsio->u.els_plogi.els_cmd = els_opcode;
    3105         elsio->u.els_plogi.els_plogi_pyld->opcode = els_opcode;
    3106 
    3107         if (els_opcode == ELS_DCMD_PLOGI && DBELL_ACTIVE(vha)) {
    3108                 struct fc_els_flogi *p = ptr;
    3109                 p->fl_csp.sp_features |= cpu_to_be16(FC_SP_FT_SEC);
    3110         }
    3111 
    3112         ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x3073, "PLOGI buffer:\n");
    3113         ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x0109,
    3114             (uint8_t *)elsio->u.els_plogi.els_plogi_pyld,
    3115             sizeof(*elsio->u.els_plogi.els_plogi_pyld));
    3116 
    3117         rval = qla2x00_start_sp(sp);
    3118         if (rval != QLA_SUCCESS) {
    3119                 fcport->flags |= FCF_LOGIN_NEEDED;
    3120                 set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
    3121                 goto done_free_sp;
    3122         } else {
    3123                 ql_dbg(ql_dbg_disc, vha, 0x3074,
    3124                     "%s PLOGI sent, hdl=%x, loopid=%x, to port_id %06x from port_id %06x\n",
    3125                     sp->name, sp->handle, fcport->loop_id,
    3126                     fcport->d_id.b24, vha->d_id.b24);
    3127         }
    3128 
    3129         return rval;
    3130 
    3131 done_free_sp:
    3132         qla2x00_els_dcmd2_free(vha, &elsio->u.els_plogi);
    3133         /* ref: INIT */
    3134         kref_put(&sp->cmd_kref, qla2x00_sp_release);
    3135 done:
    3136         fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
    3137         qla2x00_set_fcport_disc_state(fcport, DSC_DELETED);
    3138         return rval;
    3139 }

regards,
dan carpenter




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux