Sfoglia il codice sorgente

Ext4Pkg: Redirect internal Open("..", /) to the proper "/"

We have been hitting many issues with ".." ASSERTing on / in internal
code, so make sure that we direct /.. to /. This is safe.

Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
Cc: Marvin Häuser <mhaeuser@posteo.de>
Reported-by: Savva Mitrofanov <savvamtr@gmail.com>
Reviewed-by: Marvin Häuser <mhaeuser@posteo.de>
Pedro Falcato 1 anno fa
parent
commit
878c4b13fb
1 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. 5 1
      Features/Ext4Pkg/Ext4Dxe/Directory.c

+ 5 - 1
Features/Ext4Pkg/Ext4Dxe/Directory.c

@@ -255,7 +255,11 @@ Ext4OpenDirent (
     // Using the parent's parent's dentry
     File->Dentry = Directory->Dentry->Parent;
 
-    ASSERT (File->Dentry != NULL);
+    if (!File->Dentry) {
+      // Someone tried .. on root, so direct them to /
+      // This is an illegal EFI Open() but is possible to hit from a variety of internal code
+      File->Dentry = Directory->Dentry;
+    }
 
     Ext4RefDentry (File->Dentry);
   } else {