ScsiBus: avoid endless loop to format UFS path
When format the UFS device path, it'll enter the endless loop.
Now add code to detect UFS node.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
diff --git a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
index 0802b61..1813640 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
@@ -316,6 +316,7 @@
SCSI_BUS_DEVICE *ScsiBusDev;
SCSI_TARGET_ID ScsiTargetId;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiInterface;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExtScsiInterface;
EFI_SCSI_BUS_PROTOCOL *BusIdentify;
@@ -425,6 +426,16 @@
} else {
ScsiBusDev->ScsiInterface = ScsiInterface;
}
+ DevicePath = ParentDevicePath;
+ while (1) {
+ if (IsDevicePathEndType (DevicePath)) {
+ break;
+ }
+ if (DevicePath->SubType == MSG_UFS_DP) {
+ return EFI_UNSUPPORTED;
+ }
+ DevicePath = NextDevicePathNode (DevicePath);
+ }
//
// Install EFI_SCSI_BUS_PROTOCOL to the controller handle, So ScsiBusDev could be