Skip to content

Commit 7ab7bca

Browse files
committed
MdeModulePkg: Add a check and close BlockIo2 protocol.
REF: tianocore#10727 During the DiskIoDriverBindingStart, both the BlockIo and BlockIo2 protocols are opened for the specified controller handle. The Instance->SharedWorkingBuffer is then allocated based on the BlockSize. If the BlockSize is zero, indicating that the handle does not support Read/Write operations, the buffer will not be allocated. A NULL check is performed on the SharedWorkingBuffer, and if it is NULL, the process jumps to the ErrorExit. In the ErrorExit section, only the BlockIo protocol is closed, while the BlockIo2 protocol remains open. Signed-off-by: Kanagavel S <[email protected]>
1 parent 523dbb6 commit 7ab7bca

File tree

1 file changed

+9
-0
lines changed
  • MdeModulePkg/Universal/Disk/DiskIoDxe

1 file changed

+9
-0
lines changed

MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c

+9
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,15 @@ DiskIoDriverBindingStart (
226226
This->DriverBindingHandle,
227227
ControllerHandle
228228
);
229+
230+
if (gDiskIoPrivateDataTemplate.BlockIo2 != NULL) {
231+
gBS->CloseProtocol (
232+
ControllerHandle,
233+
&gEfiBlockIo2ProtocolGuid,
234+
This->DriverBindingHandle,
235+
ControllerHandle
236+
);
237+
}
229238
}
230239

231240
ErrorExit1:

0 commit comments

Comments
 (0)