lkml.org 
[lkml]   [2023]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 1/1] swiotlb: do not free decrypted pages if dynamic
Date
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@intel.com>
\
 
 \ /
  Last update: 2023-11-02 16:59    [W:0.052 / U:2.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site