* [PATCH] fscrypt: Explicitly zeroize sw_secret in error path
@ 2026-10-21 22:44 Eric Biggers
2026-10-24 18:03 ` Eric Biggers
0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2026-10-21 22:44 UTC (permalink / raw)
To: linux-fscrypt; +Cc: Eric Biggers
Explicitly zeroize the sw_secret array in the case where
fscrypt_derive_sw_secret() fails, in case anything was written to it.
Doesn't really matter, but this came up in a code review.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
fs/crypto/keyring.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/crypto/keyring.c b/fs/crypto/keyring.c
index 874cc183ee624..09364fddcb7a1 100644
--- a/fs/crypto/keyring.c
+++ b/fs/crypto/keyring.c
@@ -561,8 +561,10 @@ static int add_master_key(struct super_block *sb,
if (secret->is_hw_wrapped) {
err = fscrypt_derive_sw_secret(sb, secret->bytes,
secret->size, sw_secret);
- if (err)
+ if (err) {
+ memzero_explicit(sw_secret, sizeof(sw_secret));
return err;
+ }
kdf_key = sw_secret;
kdf_key_size = sizeof(sw_secret);
/*
base-commit: ccc4d9f8912a5d9f519a34c3633fe53c8f9b429e
--
2.56.0.218.g1ec904b173-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fscrypt: Explicitly zeroize sw_secret in error path
2026-10-21 22:44 [PATCH] fscrypt: Explicitly zeroize sw_secret in error path Eric Biggers
@ 2026-10-24 18:03 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2026-10-24 18:03 UTC (permalink / raw)
To: linux-fscrypt
On Wed, Oct 21, 2026 at 10:44:31PM +0000, Eric Biggers wrote:
> Explicitly zeroize the sw_secret array in the case where
> fscrypt_derive_sw_secret() fails, in case anything was written to it.
> Doesn't really matter, but this came up in a code review.
>
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> ---
> fs/crypto/keyring.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Applied to https://git.kernel.org/pub/scm/fs/fscrypt/linux.git/log/?h=for-next
- Eric
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-24 18:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21 22:44 [PATCH] fscrypt: Explicitly zeroize sw_secret in error path Eric Biggers
2026-10-24 18:03 ` Eric Biggers
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.