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>
efi_st_error("Failed to write file\n");
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);
if (ret != EFI_SUCCESS) {
efi_st_error("GetPosition failed\n");
(unsigned int)pos);
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 */
boottime->set_mem(buf, sizeof(buf), 0);