Commit e8c99200 authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Ilya Dryomov
Browse files

libceph: don't call crypto_free_sync_skcipher() on a NULL tfm

In set_secret(), key->tfm is assigned to NULL on line 55, and then
ceph_crypto_key_destroy(key) is executed.


This happens to work because crypto_sync_skcipher is a trivial wrapper
around crypto_skcipher: &tfm->base is still 0 and crypto_free_skcipher()
handles that.  Let's not rely on the layout of crypto_sync_skcipher.

This bug is found by a static analysis tool STCheck written by us.

Fixes: 69d6302b

 ("libceph: Remove VLA usage of skcipher").
Signed-off-by: default avatarJia-Ju Bai <>
Reviewed-by: default avatarIlya Dryomov <>
Signed-off-by: default avatarIlya Dryomov <>
parent a55aa89a
......@@ -136,8 +136,10 @@ void ceph_crypto_key_destroy(struct ceph_crypto_key *key)
if (key) {
key->key = NULL;
key->tfm = NULL;
if (key->tfm) {
key->tfm = NULL;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment