FROMLIST: fscrypt: zeroize fscrypt_info before freeing

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.

Change-Id: I1942c6e977f4373c49915d164afddd589cd869c7
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
Link: https://patchwork.kernel.org/patch/11182405/
This commit is contained in:
Eric Biggers
2019-10-09 16:34:17 -07:00
committed by Alistair Delva
parent 97c9fb779b
commit 6806fd6ad5

View File

@@ -327,6 +327,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);
}