From: Thorsten Blum <blum@kernel.org>
To: "Herbert Xu" <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
"Michal Simek" <michal.simek@amd.com>,
"Harsh Jain" <h.jain@amd.com>,
"Uwe Kleine-König (The Capable Hub)"
<u.kleine-koenig@baylibre.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"Takashi Sakamoto" <o-takashi@sakamocchi.jp>
Cc: Thorsten Blum <blum@kernel.org>,
linux-crypto@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] crypto: xilinx - use kfree_sensitive() in cleanup paths
Date: Tue, 8 Sep 2026 21:00:00 +0200 [thread overview]
Message-ID: <20260908190002.403337-2-blum@kernel.org> (raw)
In zynqmp_aes_aead_cipher() and versal_aes_aead_cipher(), replace
memzero_explicit() followed by kfree() with kfree_sensitive() to
simplify the code.
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
drivers/crypto/xilinx/zynqmp-aes-gcm.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/crypto/xilinx/zynqmp-aes-gcm.c b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
index ebee37dddb1f..d9bd6dcd23a6 100644
--- a/drivers/crypto/xilinx/zynqmp-aes-gcm.c
+++ b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
@@ -230,10 +230,8 @@ static int zynqmp_aes_aead_cipher(struct aead_request *req)
}
freemem:
- memzero_explicit(kbuf, dma_size);
- kfree(kbuf);
- memzero_explicit(dmabuf, sizeof(struct zynqmp_aead_hw_req) + GCM_AES_IV_SIZE);
- kfree(dmabuf);
+ kfree_sensitive(kbuf);
+ kfree_sensitive(dmabuf);
return ret;
}
@@ -364,11 +362,9 @@ static int versal_aes_aead_cipher(struct aead_request *req)
if (unlikely(dma_addr_hw_req))
dma_unmap_single(dev, dma_addr_hw_req, dmabuf_size, DMA_BIDIRECTIONAL);
buf2_free:
- memzero_explicit(dmabuf, dmabuf_size);
- kfree(dmabuf);
+ kfree_sensitive(dmabuf);
buf1_free:
- memzero_explicit(kbuf, kbuf_size);
- kfree(kbuf);
+ kfree_sensitive(kbuf);
err:
return ret;
}
next reply other threads:[~2026-09-08 19:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 19:00 Thorsten Blum [this message]
2026-09-09 9:27 ` [PATCH] crypto: xilinx - use kfree_sensitive() in cleanup paths Jain, Harsh (AECG-SSW)
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=20260908190002.403337-2-blum@kernel.org \
--to=blum@kernel.org \
--cc=dakr@kernel.org \
--cc=davem@davemloft.net \
--cc=h.jain@amd.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=o-takashi@sakamocchi.jp \
--cc=u.kleine-koenig@baylibre.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.