On 30/10/2024 07:55, Aneesh Kumar K.V wrote: > Steven Price <steven.price@xxxxxxx> writes: > >> + >> +out_undelegate_tables: >> + while (--i >= 0) { >> + phys_addr_t pgd_phys = kvm->arch.mmu.pgd_phys + i * PAGE_SIZE; >> + >> + WARN_ON(rmi_granule_undelegate(pgd_phys)); >> + } >> + WARN_ON(rmi_granule_undelegate(rd_phys)); >> +free_rd: >> + free_page((unsigned long)rd); >> + return r; >> +} >> + > > we should avoid that free_page on an undelegate failure? rd_phys we can > handle here. Not sure how to handle the pgd_phys. Good point. I think for pgd_phys setting kvm->arch.mmu.pgt=NULL should be sufficient to prevent the pages being freed. Thanks, Steve