mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-17 22:49:02 +00:00
efi_selftest: block device: avoid read after free
Reading the position in a file after closing the same results in a read after free. Correct the sequence in the test. Reported-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
1f2e948d6d
commit
05aceb2b1c
1 changed files with 5 additions and 5 deletions
|
@ -445,11 +445,6 @@ static int execute(void)
|
||||||
efi_st_error("Failed to write file\n");
|
efi_st_error("Failed to write file\n");
|
||||||
return EFI_ST_FAILURE;
|
return EFI_ST_FAILURE;
|
||||||
}
|
}
|
||||||
ret = file->close(file);
|
|
||||||
if (ret != EFI_SUCCESS) {
|
|
||||||
efi_st_error("Failed to close file\n");
|
|
||||||
return EFI_ST_FAILURE;
|
|
||||||
}
|
|
||||||
ret = file->getpos(file, &pos);
|
ret = file->getpos(file, &pos);
|
||||||
if (ret != EFI_SUCCESS) {
|
if (ret != EFI_SUCCESS) {
|
||||||
efi_st_error("GetPosition failed\n");
|
efi_st_error("GetPosition failed\n");
|
||||||
|
@ -460,6 +455,11 @@ static int execute(void)
|
||||||
(unsigned int)pos);
|
(unsigned int)pos);
|
||||||
return EFI_ST_FAILURE;
|
return EFI_ST_FAILURE;
|
||||||
}
|
}
|
||||||
|
ret = file->close(file);
|
||||||
|
if (ret != EFI_SUCCESS) {
|
||||||
|
efi_st_error("Failed to close file\n");
|
||||||
|
return EFI_ST_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Verify file */
|
/* Verify file */
|
||||||
boottime->set_mem(buf, sizeof(buf), 0);
|
boottime->set_mem(buf, sizeof(buf), 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue