efi_loader: efi_capsule_delete_file() NULL dereference

If opening a file fails, the file handle pointer is not valid and must not
be dereferenced.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
Heinrich Schuchardt 2021-06-02 19:28:22 +02:00
parent 3dca77b1dc
commit e27b0ff1b7
1 changed files with 2 additions and 1 deletions

View File

@ -901,7 +901,8 @@ static efi_status_t efi_capsule_delete_file(const u16 *filename)
/* ignore an error */
EFI_CALL((*dirh->close)(dirh));
ret = EFI_CALL((*fh->delete)(fh));
if (ret == EFI_SUCCESS)
ret = EFI_CALL((*fh->delete)(fh));
return ret;
}