Print this page
4233 mptsas topo change buffer overflow

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c
          +++ new/usr/src/uts/common/io/scsi/adapters/mpt_sas/mptsas.c
↓ open down ↓ 863 lines elided ↑ open up ↑
 864  864          }
 865  865          if (ddi_prop_update_int(DDI_DEV_T_NONE, dip,
 866  866              MPTSAS_VIRTUAL_PORT, 0) !=
 867  867              DDI_PROP_SUCCESS) {
 868  868                  (void) ddi_prop_remove(DDI_DEV_T_NONE, dip,
 869  869                      MPTSAS_VIRTUAL_PORT);
 870  870                  mptsas_log(mpt, CE_WARN, "mptsas virtual port "
 871  871                      "prop update failed");
 872  872                  return (DDI_FAILURE);
 873  873          }
 874      -        mptsas_smhba_set_phy_props(mpt,
 875      -            iport, dip, numphys, &attached_devhdl);
      874 +        mptsas_smhba_set_all_phy_props(mpt, dip, numphys, phy_mask,
      875 +            &attached_devhdl);
 876  876  
 877  877          mutex_enter(&mpt->m_mutex);
 878  878          page_address = (MPI2_SAS_DEVICE_PGAD_FORM_HANDLE &
 879  879              MPI2_SAS_DEVICE_PGAD_FORM_MASK) | (uint32_t)attached_devhdl;
 880  880          rval = mptsas_get_sas_device_page0(mpt, page_address, &dev_hdl,
 881  881              &attached_sas_wwn, &dev_info, &phy_port, &phy_id,
 882  882              &pdev_hdl, &bay_num, &enclosure);
 883  883          if (rval != DDI_SUCCESS) {
 884  884                  mptsas_log(mpt, CE_WARN,
 885  885                      "Failed to get device page0 for handle:%d",
↓ open down ↓ 5060 lines elided ↑ open up ↑
5946 5946                                   * Update PHY info for smhba
5947 5947                                   */
5948 5948                                  mutex_enter(&mpt->m_mutex);
5949 5949                                  if (mptsas_smhba_phy_init(mpt)) {
5950 5950                                          mutex_exit(&mpt->m_mutex);
5951 5951                                          mptsas_log(mpt, CE_WARN, "mptsas phy"
5952 5952                                              " update failed");
5953 5953                                          return;
5954 5954                                  }
5955 5955                                  mutex_exit(&mpt->m_mutex);
5956      -                                mptsas_smhba_set_phy_props(mpt,
5957      -                                    ddi_get_name_addr(parent), parent,
5958      -                                    1, &attached_devhdl);
     5956 +
     5957 +                                /*
     5958 +                                 * topo_node->un.physport is really the PHY#
     5959 +                                 * for direct attached devices
     5960 +                                 */
     5961 +                                mptsas_smhba_set_one_phy_props(mpt, parent,
     5962 +                                    topo_node->un.physport, &attached_devhdl);
     5963 +
5959 5964                                  if (ddi_prop_update_int(DDI_DEV_T_NONE, parent,
5960 5965                                      MPTSAS_VIRTUAL_PORT, 0) !=
5961 5966                                      DDI_PROP_SUCCESS) {
5962 5967                                          (void) ddi_prop_remove(DDI_DEV_T_NONE,
5963 5968                                              parent, MPTSAS_VIRTUAL_PORT);
5964 5969                                          mptsas_log(mpt, CE_WARN,
5965 5970                                              "mptsas virtual-port"
5966 5971                                              "port prop update failed");
5967 5972                                          return;
5968 5973                                  }
↓ open down ↓ 8923 lines elided ↑ open up ↑
14892 14897                   * Update PHY info for smhba
14893 14898                   */
14894 14899                  if (mptsas_smhba_phy_init(mpt)) {
14895 14900                          mutex_exit(&mpt->m_mutex);
14896 14901                          mptsas_log(mpt, CE_WARN, "mptsas phy update "
14897 14902                              "failed");
14898 14903                          goto smp_create_done;
14899 14904                  }
14900 14905                  mutex_exit(&mpt->m_mutex);
14901 14906  
14902      -                mptsas_smhba_set_phy_props(mpt, iport, pdip,
14903      -                    numphys, &attached_devhdl);
     14907 +                mptsas_smhba_set_all_phy_props(mpt, pdip, numphys, phy_mask,
     14908 +                    &attached_devhdl);
14904 14909  
14905 14910                  if (ddi_prop_update_int(DDI_DEV_T_NONE, pdip,
14906 14911                      MPTSAS_NUM_PHYS, numphys) !=
14907 14912                      DDI_PROP_SUCCESS) {
14908 14913                          (void) ddi_prop_remove(DDI_DEV_T_NONE, pdip,
14909 14914                              MPTSAS_NUM_PHYS);
14910 14915                          mptsas_log(mpt, CE_WARN, "mptsas update "
14911 14916                              "num phys props failed");
14912 14917                          goto smp_create_done;
14913 14918                  }
↓ open down ↓ 760 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX