@@ -158,6 +158,12 @@ void destroy_secure_world(struct vm *vm, bool need_clr_mem)
158
158
pr_err ("Parse vm0 context failed." );
159
159
return ;
160
160
}
161
+
162
+ if (vm -> arch_vm .sworld_eptp == NULL ) {
163
+ pr_err ("sworld eptp is NULL, it's not created" );
164
+ return ;
165
+ }
166
+
161
167
if (need_clr_mem ) {
162
168
/* clear trusty memory space */
163
169
(void )memset (hpa2hva (hpa ), 0U , size );
@@ -176,17 +182,13 @@ void destroy_secure_world(struct vm *vm, bool need_clr_mem)
176
182
}
177
183
178
184
/* Free trusty ept page-structures */
179
- if (vm -> arch_vm .sworld_eptp != NULL ) {
180
- pdpt_addr =
185
+ pdpt_addr =
181
186
(void * )pml4e_page_vaddr (* (uint64_t * )vm -> arch_vm .sworld_eptp );
182
- /* memset PDPTEs except trusty memory */
183
- (void )memset (pdpt_addr , 0UL ,
184
- NON_TRUSTY_PDPT_ENTRIES * sizeof (uint64_t ));
185
- free_ept_mem ((uint64_t * )vm -> arch_vm .sworld_eptp );
186
- vm -> arch_vm .sworld_eptp = NULL ;
187
- } else {
188
- pr_err ("sworld eptp is NULL" );
189
- }
187
+ /* memset PDPTEs except trusty memory */
188
+ (void )memset (pdpt_addr , 0UL ,
189
+ NON_TRUSTY_PDPT_ENTRIES * sizeof (uint64_t ));
190
+ free_ept_mem ((uint64_t * )vm -> arch_vm .sworld_eptp );
191
+ vm -> arch_vm .sworld_eptp = NULL ;
190
192
}
191
193
192
194
static void save_world_ctx (struct vcpu * vcpu , struct ext_context * ext_ctx )
0 commit comments