be2iscsi: Fix to remove shutdown entry point
authorJitendra Bhivare <jitendra.bhivare@avagotech.com>
Wed, 20 Jan 2016 08:40:51 +0000 (14:10 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 24 Feb 2016 02:27:02 +0000 (21:27 -0500)
Null pointer dereference in shutdown path after taking dump.

Shutdown path is not needed as FW comes up clean every time during probe
after issuing FUNCTION reset MBOX command.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/be2iscsi/be_cmds.c
drivers/scsi/be2iscsi/be_cmds.h
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/be2iscsi/be_main.h

index f93ab6d937f4675e5e43a59e6a5f487838354727..66a1fc3f3ddcf01cef5b58cbbae5b93bbe6fac13 100644 (file)
@@ -417,22 +417,11 @@ static struct be_mcc_compl *be_mcc_compl_get(struct beiscsi_hba *phba)
 }
 
 /**
- * be2iscsi_fail_session(): Closing session with appropriate error
+ * beiscsi_fail_session(): Closing session with appropriate error
  * @cls_session: ptr to session
- *
- * Depending on adapter state appropriate error flag is passed.
  **/
-void be2iscsi_fail_session(struct iscsi_cls_session *cls_session)
+void beiscsi_fail_session(struct iscsi_cls_session *cls_session)
 {
-       struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
-       struct beiscsi_hba *phba = iscsi_host_priv(shost);
-       uint32_t iscsi_err_flag;
-
-       if (phba->state & BE_ADAPTER_STATE_SHUTDOWN)
-               iscsi_err_flag = ISCSI_ERR_INVALID_HOST;
-       else
-               iscsi_err_flag = ISCSI_ERR_CONN_FAILED;
-
        iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
 }
 
@@ -450,7 +439,7 @@ void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
                            evt->physical_port);
 
                iscsi_host_for_each_session(phba->shost,
-                                           be2iscsi_fail_session);
+                                           beiscsi_fail_session);
        } else if ((evt->port_link_status & ASYNC_EVENT_LINK_UP) ||
                    ((evt->port_link_status & ASYNC_EVENT_LOGICAL) &&
                     (evt->port_fault == BEISCSI_PHY_LINK_FAULT_NONE))) {
index 1883d320e22d5970911258682f596dfedeb2f767..f988164476159feb4b96fa87ebfac5b82a0226fa 100644 (file)
@@ -1367,5 +1367,5 @@ void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len,
 void be_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
                        u8 subsystem, u8 opcode, int cmd_len);
 
-void be2iscsi_fail_session(struct iscsi_cls_session *cls_session);
+void beiscsi_fail_session(struct iscsi_cls_session *cls_session);
 #endif /* !BEISCSI_CMDS_H */
index ca3dc4bfc4cf0eaab2c4f87ad1fc3e2fd2542672..5aab8fd32e4d9bd6e62caa91bf3417c34b45cf03 100644 (file)
@@ -5313,7 +5313,6 @@ static void beiscsi_quiesce(struct beiscsi_hba *phba,
 
 static void beiscsi_remove(struct pci_dev *pcidev)
 {
-
        struct beiscsi_hba *phba = NULL;
 
        phba = pci_get_drvdata(pcidev);
@@ -5323,9 +5322,9 @@ static void beiscsi_remove(struct pci_dev *pcidev)
        }
 
        beiscsi_destroy_def_ifaces(phba);
-       beiscsi_quiesce(phba, BEISCSI_CLEAN_UNLOAD);
        iscsi_boot_destroy_kset(phba->boot_kset);
        iscsi_host_remove(phba->shost);
+       beiscsi_quiesce(phba, BEISCSI_CLEAN_UNLOAD);
        pci_dev_put(phba->pcidev);
        iscsi_host_free(phba->shost);
        pci_disable_pcie_error_reporting(pcidev);
@@ -5334,23 +5333,6 @@ static void beiscsi_remove(struct pci_dev *pcidev)
        pci_disable_device(pcidev);
 }
 
-static void beiscsi_shutdown(struct pci_dev *pcidev)
-{
-
-       struct beiscsi_hba *phba = NULL;
-
-       phba = (struct beiscsi_hba *)pci_get_drvdata(pcidev);
-       if (!phba) {
-               dev_err(&pcidev->dev, "beiscsi_shutdown called with no phba\n");
-               return;
-       }
-
-       phba->state = BE_ADAPTER_STATE_SHUTDOWN;
-       iscsi_host_for_each_session(phba->shost, be2iscsi_fail_session);
-       beiscsi_quiesce(phba, BEISCSI_CLEAN_UNLOAD);
-       pci_disable_device(pcidev);
-}
-
 static void beiscsi_msix_enable(struct beiscsi_hba *phba)
 {
        int i, status;
@@ -5670,6 +5652,9 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
                goto hba_free;
        }
 
+       /*
+        * FUNCTION_RESET should clean up any stale info in FW for this fn
+        */
        ret = beiscsi_cmd_reset_function(phba);
        if (ret) {
                beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
@@ -5857,7 +5842,6 @@ static struct pci_driver beiscsi_pci_driver = {
        .name = DRV_NAME,
        .probe = beiscsi_dev_probe,
        .remove = beiscsi_remove,
-       .shutdown = beiscsi_shutdown,
        .id_table = beiscsi_pci_id_table,
        .err_handler = &beiscsi_eeh_handlers
 };
index 5c67c0732241b507e199ff756ad1c60e17c0b703..bd9d1e175b075115c3c967ff69859709d4127776 100644 (file)
 #define BE_ADAPTER_LINK_UP     0x001
 #define BE_ADAPTER_LINK_DOWN   0x002
 #define BE_ADAPTER_PCI_ERR     0x004
-#define BE_ADAPTER_STATE_SHUTDOWN      0x008
-#define BE_ADAPTER_CHECK_BOOT  0x010
+#define BE_ADAPTER_CHECK_BOOT  0x008
 
 
 #define BEISCSI_CLEAN_UNLOAD   0x01