On Thu, 2023-11-02 at 10:36 +0100, Petr Tesarik wrote: > + vaddr = phys_to_virt(paddr); > if (set_memory_decrypted((unsigned long)vaddr, > PFN_UP(bytes))) > goto error; > return page; > > error: > - __free_pages(page, order); > + /* Intentional leak if pages cannot be encrypted again. */ > + if (!set_memory_encrypted((unsigned long)vaddr, > PFN_UP(bytes))) > + __free_pages(page, order); > return NULL; > } My patch was going to just leak the pages if set_memory_decrypted() fails, and not try to re-encrypt. It didn't seem worth the extra logic for the rare case. But this works too. Reviewed-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>