[edk2-devel] [PATCH 1/1] OvmfPkg/VirtioFsDxe: fix SimpleFileOpen

Gerd Hoffmann kraxel at redhat.com
Wed Oct 18 10:33:28 UTC 2023


VirtiofsDxe throws an error in case the caller tries to open a file or
directory using an handle with is not a directory, claiming that opening
something relative to a file does not make sense.

The claim is correct, but the code throws errors for both relative and
absolute paths.  Add a check to fix that.

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 OvmfPkg/VirtioFsDxe/SimpleFsOpen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c b/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c
index a13d4f6a1e2d..1729ea2f5cf2 100644
--- a/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c
+++ b/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c
@@ -397,7 +397,7 @@ VirtioFsSimpleFileOpen (
   // it cannot be implemented consistently with how a file is referred to
   // relative to a directory).
   //
-  if (!VirtioFsFile->IsDirectory) {
+  if (!VirtioFsFile->IsDirectory && FileName[0] != '\\') {
     DEBUG ((
       DEBUG_ERROR,
       ("%a: Label=\"%s\" CanonicalPathname=\"%a\" FileName=\"%s\": "
-- 
2.41.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109727): https://edk2.groups.io/g/devel/message/109727
Mute This Topic: https://groups.io/mt/102036263/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list