There are many reasons of failure from get_secret(), so it's necessary to add a check before calling crypto_free_skcipher() in case of NULL pointer dereference. Signed-off-by: Chengguang Xu <cgxu519@xxxxxxxxxx> --- net/ceph/crypto.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c index bf9d079..bb1dc2d 100644 --- a/net/ceph/crypto.c +++ b/net/ceph/crypto.c @@ -136,8 +136,10 @@ void ceph_crypto_key_destroy(struct ceph_crypto_key *key) if (key) { kfree(key->key); key->key = NULL; - crypto_free_skcipher(key->tfm); - key->tfm = NULL; + if (key->tfm) { + crypto_free_skcipher(key->tfm); + key->tfm = NULL; + } } } -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html