[edk2-devel] [PATCH 1/1] Ext4Pkg: Redirect internal Open("..", /) to the proper "/"

Marvin Häuser mhaeuser at posteo.de
Mon Jan 30 19:54:01 UTC 2023


Reviewed-by: Marvin Häuser <mhaeuser at posteo.de <mailto:mhaeuser at posteo.de>>

> On 30. Jan 2023, at 18:58, Pedro Falcato <pedro.falcato at gmail.com> wrote:
> 
> 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 at gmail.com>
> Cc: Marvin Häuser <mhaeuser at posteo.de>
> Reported-by: Savva Mitrofanov <savvamtr at gmail.com>
> ---
> Features/Ext4Pkg/Ext4Dxe/Directory.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/Features/Ext4Pkg/Ext4Dxe/Directory.c b/Features/Ext4Pkg/Ext4Dxe/Directory.c
> index 456916453952..73d21d9f9542 100644
> --- a/Features/Ext4Pkg/Ext4Dxe/Directory.c
> +++ b/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 {
> -- 
> 2.39.0
> 



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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/edk2-devel-archive/attachments/20230130/c19dbf45/attachment.htm>


More information about the edk2-devel-archive mailing list