[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e0129428bc80f9deaf7a6852007d48103e133e27.camel@intel.com>
Date: Thu, 2 Nov 2023 15:57:55 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "robin.murphy@....com" <robin.murphy@....com>,
"hch@....de" <hch@....de>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"patchwork@...wei.com" <patchwork@...wei.com>,
"petrtesarik@...weicloud.com" <petrtesarik@...weicloud.com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"m.szyprowski@...sung.com" <m.szyprowski@...sung.com>,
"petr.tesarik1@...wei-partners.com"
<petr.tesarik1@...wei-partners.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: "miaoxie@...wei.com" <miaoxie@...wei.com>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
"guohanjun@...wei.com" <guohanjun@...wei.com>,
"leijitang@...wei.com" <leijitang@...wei.com>,
"weiyongjun1@...wei.com" <weiyongjun1@...wei.com>,
"huawei.libin@...wei.com" <huawei.libin@...wei.com>,
"wangkefeng.wang@...wei.com" <wangkefeng.wang@...wei.com>,
"linuxarm@...wei.com" <linuxarm@...wei.com>,
"johnny.chenyi@...wei.com" <johnny.chenyi@...wei.com>,
"yuehaibing@...wei.com" <yuehaibing@...wei.com>,
"petr@...arici.cz" <petr@...arici.cz>,
"roberto.sassu@...weicloud.com" <roberto.sassu@...weicloud.com>,
"ming.fu@...wei.com" <ming.fu@...wei.com>,
"zhujianwei7@...wei.com" <zhujianwei7@...wei.com>
Subject: Re: [PATCH v2 1/1] swiotlb: do not free decrypted pages if dynamic
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@...el.com>
Powered by blists - more mailing lists