[edk2-devel] [edk2-platforms][PATCH v3 09/11] Ext4Pkg: Add missing exit Status in Ext4OpenDirent

Savva Mitrofanov posted 11 patches 3 years ago
There is a newer version of this series
[edk2-devel] [edk2-platforms][PATCH v3 09/11] Ext4Pkg: Add missing exit Status in Ext4OpenDirent
Posted by Savva Mitrofanov 3 years ago
Missing EFI_OUT_OF_RESOURCES exit status on failed Ext4CreateDentry
leads to NULL-pointer dereference in Ext4GetFileInfo (passing NULL
buffer in Ext4ReadDir)

Cc: Marvin Häuser <mhaeuser@posteo.de>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Fixes: 21b1853880d5 ("Ext4Pkg: Add a directory entry tree.")
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
---
 Features/Ext4Pkg/Ext4Dxe/Directory.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Features/Ext4Pkg/Ext4Dxe/Directory.c b/Features/Ext4Pkg/Ext4Dxe/Directory.c
index 2e9a58a7e329..0753a20b5377 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Directory.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Directory.c
@@ -267,7 +267,8 @@ Ext4OpenDirent (
   } else {

     File->Dentry = Ext4CreateDentry (FileName, Directory->Dentry);

 

-    if (!File->Dentry) {

+    if (File->Dentry == NULL) {

+      Status = EFI_OUT_OF_RESOURCES;

       goto Error;

     }

   }

-- 
2.39.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99144): https://edk2.groups.io/g/devel/message/99144
Mute This Topic: https://groups.io/mt/96562697/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-platforms][PATCH v3 09/11] Ext4Pkg: Add missing exit Status in Ext4OpenDirent
Posted by Pedro Falcato 3 years ago
On Fri, Jan 27, 2023 at 9:29 AM Savva Mitrofanov <savvamtr@gmail.com> wrote:
>
> Missing EFI_OUT_OF_RESOURCES exit status on failed Ext4CreateDentry
> leads to NULL-pointer dereference in Ext4GetFileInfo (passing NULL
> buffer in Ext4ReadDir)
>
> Cc: Marvin Häuser <mhaeuser@posteo.de>
> Cc: Pedro Falcato <pedro.falcato@gmail.com>
> Cc: Vitaly Cheptsov <vit9696@protonmail.com>
> Fixes: 21b1853880d5 ("Ext4Pkg: Add a directory entry tree.")
> Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
> ---
>  Features/Ext4Pkg/Ext4Dxe/Directory.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Features/Ext4Pkg/Ext4Dxe/Directory.c b/Features/Ext4Pkg/Ext4Dxe/Directory.c
> index 2e9a58a7e329..0753a20b5377 100644
> --- a/Features/Ext4Pkg/Ext4Dxe/Directory.c
> +++ b/Features/Ext4Pkg/Ext4Dxe/Directory.c
> @@ -267,7 +267,8 @@ Ext4OpenDirent (
>    } else {
>      File->Dentry = Ext4CreateDentry (FileName, Directory->Dentry);
>
> -    if (!File->Dentry) {
> +    if (File->Dentry == NULL) {
> +      Status = EFI_OUT_OF_RESOURCES;
>        goto Error;
>      }
>    }
> --
> 2.39.0
>

Reviewed-by: Pedro Falcato <pedro.falcato@gmail.com>

-- 
Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99171): https://edk2.groups.io/g/devel/message/99171
Mute This Topic: https://groups.io/mt/96562697/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-platforms][PATCH v3 09/11] Ext4Pkg: Add missing exit Status in Ext4OpenDirent
Posted by Marvin Häuser 3 years ago
Reviewed-by: Marvin Häuser <mhaeuser@posteo.de>

> On 27. Jan 2023, at 15:28, Pedro Falcato <pedro.falcato@gmail.com> wrote:
> 
> On Fri, Jan 27, 2023 at 9:29 AM Savva Mitrofanov <savvamtr@gmail.com> wrote:
>> 
>> Missing EFI_OUT_OF_RESOURCES exit status on failed Ext4CreateDentry
>> leads to NULL-pointer dereference in Ext4GetFileInfo (passing NULL
>> buffer in Ext4ReadDir)
>> 
>> Cc: Marvin Häuser <mhaeuser@posteo.de>
>> Cc: Pedro Falcato <pedro.falcato@gmail.com>
>> Cc: Vitaly Cheptsov <vit9696@protonmail.com>
>> Fixes: 21b1853880d5 ("Ext4Pkg: Add a directory entry tree.")
>> Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
>> ---
>> Features/Ext4Pkg/Ext4Dxe/Directory.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/Features/Ext4Pkg/Ext4Dxe/Directory.c b/Features/Ext4Pkg/Ext4Dxe/Directory.c
>> index 2e9a58a7e329..0753a20b5377 100644
>> --- a/Features/Ext4Pkg/Ext4Dxe/Directory.c
>> +++ b/Features/Ext4Pkg/Ext4Dxe/Directory.c
>> @@ -267,7 +267,8 @@ Ext4OpenDirent (
>>   } else {
>>     File->Dentry = Ext4CreateDentry (FileName, Directory->Dentry);
>> 
>> -    if (!File->Dentry) {
>> +    if (File->Dentry == NULL) {
>> +      Status = EFI_OUT_OF_RESOURCES;
>>       goto Error;
>>     }
>>   }
>> --
>> 2.39.0
>> 
> 
> Reviewed-by: Pedro Falcato <pedro.falcato@gmail.com>
> 
> -- 
> Pedro



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99176): https://edk2.groups.io/g/devel/message/99176
Mute This Topic: https://groups.io/mt/96562697/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-