From: Alexey Kardashevskiy <aik@amd.com>
To: <linux-crypto@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
Ashish Kalra <ashish.kalra@amd.com>,
"Tom Lendacky" <thomas.lendacky@amd.com>,
Alexey Kardashevskiy <aik@amd.com>
Subject: [PATCH] KVM: SVM: snp_alloc_firmware_pages: memory leak
Date: Fri, 14 Feb 2025 14:59:32 +1100 [thread overview]
Message-ID: <20250214035932.3414337-1-aik@amd.com> (raw)
Failure to rmpupdate leads to page(s) leak, fix that.
Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
---
drivers/crypto/ccp/sev-dev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index 2e87ca0e292a..0b5f8ab657c5 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -443,8 +443,10 @@ static struct page *__snp_alloc_firmware_pages(gfp_t gfp_mask, int order)
return page;
paddr = __pa((unsigned long)page_address(page));
- if (rmp_mark_pages_firmware(paddr, npages, false))
+ if (rmp_mark_pages_firmware(paddr, npages, false)) {
+ __free_pages(page, order);
return NULL;
+ }
return page;
}
--
2.47.1
next reply other threads:[~2025-02-14 3:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 3:59 Alexey Kardashevskiy [this message]
2025-02-14 14:53 ` [PATCH] KVM: SVM: snp_alloc_firmware_pages: memory leak Tom Lendacky
2025-02-18 1:24 ` Alexey Kardashevskiy
2025-02-18 14:42 ` Tom Lendacky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250214035932.3414337-1-aik@amd.com \
--to=aik@amd.com \
--cc=ashish.kalra@amd.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas.lendacky@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox