fscrypt: zeroize fscrypt_info before freeing
Eric Biggers
maintainerPATCH 1/1 fscrypt: zeroize fscrypt_info before freeing
From: Eric Biggers <[email protected]>
memset the struct fscrypt_info to zero before freeing. This isn't really needed currently, since there's no secret key directly in the fscrypt_info. But there's a decent chance that someone will add such a field in the future, e.g. in order to use an API that takes a raw key such as siphash(). So it's good to do this as a hardening measure.
--- fs/crypto/keysetup.c | 1 + 1 file changed, 1 insertion(+)
fs/crypto/keysetup.c +1 -0
@@ -325,6 +325,7 @@ static void put_crypt_info(struct fscrypt_info *ci)key_invalidate (key);key_put (key); } +memzero_explicit (ci,sizeof (*ci));kmem_cache_free (fscrypt_info_cachep, ci); }
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
Quoted 28 lines · Eric Biggers
From: Eric Biggers <[email protected]>
memset the struct
fscrypt_infoto zero before freeing. This isn't really needed currently, since there's no secret key directly in thefscrypt_info. But there's a decent chance that someone will add such a field in the future, e.g. in order to use an API that takes a raw key such assiphash(). So it's good to do this as a hardening measure.Signed-off-by Eric Biggers <[email protected]>--- fs/crypto/keysetup.c | 1 + 1 file changed, 1 insertion(+)fs/crypto/keysetup.c +1
-0@@ -325,6 +325,7 @@ static void put_crypt_info(struct fscrypt_info *ci)key_invalidate (key);key_put (key); } +memzero_explicit (ci,sizeof (*ci));kmem_cache_free (fscrypt_info_cachep, ci); }Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
Applied to fscrypt.git for 5.5.
- Eric