static void snp_leak_hv_fixed_pages(void)
{
- struct snp_hv_fixed_pages_entry *entry;
+ struct snp_hv_fixed_pages_entry *entry, *nentry;
/* List is protected by sev_cmd_mutex */
lockdep_assert_held(&sev_cmd_mutex);
if (list_empty(&snp_hv_fixed_pages))
return;
- list_for_each_entry(entry, &snp_hv_fixed_pages, list)
- if (entry->page_state == HV_FIXED)
+ list_for_each_entry_safe(entry, nentry, &snp_hv_fixed_pages, list) {
+ if (entry->free && entry->page_state != HV_FIXED)
+ __free_pages(entry->page, entry->order);
+ else
__snp_leak_pages(page_to_pfn(entry->page),
1 << entry->order, false);
+
+ list_del(&entry->list);
+ kfree(entry);
+ }
}
bool sev_is_snp_ciphertext_hiding_supported(void)
if (data.x86_snp_shutdown) {
if (!panic)
snp_shutdown();
+ snp_hv_fixed_pages_state_update(sev, ALLOCATED);
} else {
/*
* SNP_SHUTDOWN_EX with IOMMU_SNP_SHUTDOWN set to 1 disables SNP