Print this page
4233 mptsas topo change buffer overflow

@@ -869,12 +869,12 @@
                     MPTSAS_VIRTUAL_PORT);
                 mptsas_log(mpt, CE_WARN, "mptsas virtual port "
                     "prop update failed");
                 return (DDI_FAILURE);
         }
-        mptsas_smhba_set_phy_props(mpt,
-            iport, dip, numphys, &attached_devhdl);
+        mptsas_smhba_set_all_phy_props(mpt, dip, numphys, phy_mask,
+            &attached_devhdl);
 
         mutex_enter(&mpt->m_mutex);
         page_address = (MPI2_SAS_DEVICE_PGAD_FORM_HANDLE &
             MPI2_SAS_DEVICE_PGAD_FORM_MASK) | (uint32_t)attached_devhdl;
         rval = mptsas_get_sas_device_page0(mpt, page_address, &dev_hdl,

@@ -5951,13 +5951,18 @@
                                         mptsas_log(mpt, CE_WARN, "mptsas phy"
                                             " update failed");
                                         return;
                                 }
                                 mutex_exit(&mpt->m_mutex);
-                                mptsas_smhba_set_phy_props(mpt,
-                                    ddi_get_name_addr(parent), parent,
-                                    1, &attached_devhdl);
+
+                                /*
+                                 * topo_node->un.physport is really the PHY#
+                                 * for direct attached devices
+                                 */
+                                mptsas_smhba_set_one_phy_props(mpt, parent,
+                                    topo_node->un.physport, &attached_devhdl);
+
                                 if (ddi_prop_update_int(DDI_DEV_T_NONE, parent,
                                     MPTSAS_VIRTUAL_PORT, 0) !=
                                     DDI_PROP_SUCCESS) {
                                         (void) ddi_prop_remove(DDI_DEV_T_NONE,
                                             parent, MPTSAS_VIRTUAL_PORT);

@@ -14897,12 +14902,12 @@
                             "failed");
                         goto smp_create_done;
                 }
                 mutex_exit(&mpt->m_mutex);
 
-                mptsas_smhba_set_phy_props(mpt, iport, pdip,
-                    numphys, &attached_devhdl);
+                mptsas_smhba_set_all_phy_props(mpt, pdip, numphys, phy_mask,
+                    &attached_devhdl);
 
                 if (ddi_prop_update_int(DDI_DEV_T_NONE, pdip,
                     MPTSAS_NUM_PHYS, numphys) !=
                     DDI_PROP_SUCCESS) {
                         (void) ddi_prop_remove(DDI_DEV_T_NONE, pdip,