Print this page
4403 mpt_sas panic when pulling a drive
        
*** 2019,2028 ****
--- 2019,2029 ----
  static int
  mptsas_alloc_handshake_msg(mptsas_t *mpt, size_t alloc_size)
  {
          ddi_dma_attr_t  task_dma_attrs;
  
+         mpt->m_hshk_dma_size = 0;
          task_dma_attrs = mpt->m_msg_dma_attr;
          task_dma_attrs.dma_attr_sgllen = 1;
          task_dma_attrs.dma_attr_granular = (uint32_t)(alloc_size);
  
          /* allocate Task Management ddi_dma resources */
*** 2037,2046 ****
--- 2038,2049 ----
  }
  
  static void
  mptsas_free_handshake_msg(mptsas_t *mpt)
  {
+         if (mpt->m_hshk_dma_size == 0)
+                 return;
          mptsas_dma_addr_destroy(&mpt->m_hshk_dma_hdl, &mpt->m_hshk_acc_hdl);
          mpt->m_hshk_dma_size = 0;
  }
  
  static int
*** 15442,15469 ****
          if (cookiep == NULL)
                  cookiep = &new_cookie;
  
          if (ddi_dma_alloc_handle(mpt->m_dip, &dma_attr, DDI_DMA_SLEEP,
              NULL, dma_hdp) != DDI_SUCCESS) {
-                 dma_hdp = NULL;
                  return (FALSE);
          }
  
          if (ddi_dma_mem_alloc(*dma_hdp, alloc_size, &mpt->m_dev_acc_attr,
              DDI_DMA_CONSISTENT, DDI_DMA_SLEEP, NULL, dma_memp, &alloc_len,
              acc_hdp) != DDI_SUCCESS) {
                  ddi_dma_free_handle(dma_hdp);
-                 dma_hdp = NULL;
                  return (FALSE);
          }
  
          if (ddi_dma_addr_bind_handle(*dma_hdp, NULL, *dma_memp, alloc_len,
              (DDI_DMA_RDWR | DDI_DMA_CONSISTENT), DDI_DMA_SLEEP, NULL,
              cookiep, &ncookie) != DDI_DMA_MAPPED) {
                  (void) ddi_dma_mem_free(acc_hdp);
                  ddi_dma_free_handle(dma_hdp);
-                 dma_hdp = NULL;
                  return (FALSE);
          }
  
          return (TRUE);
  }
--- 15445,15469 ----
*** 15475,15481 ****
                  return;
  
          (void) ddi_dma_unbind_handle(*dma_hdp);
          (void) ddi_dma_mem_free(acc_hdp);
          ddi_dma_free_handle(dma_hdp);
-         dma_hdp = NULL;
  }
--- 15475,15480 ----