libceph: fix crypto key null deref, memory leak
Avoid crashing if the crypto key payload was NULL, as when it was not correctly allocated and initialized. Also, avoid leaking it. Signed-off-by: Sylvain Munaut <tnt@246tNt.com> Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Alex Elder <elder@inktank.com>
This commit is contained in:

committed by
Sage Weil

parent
5ef50c3bec
commit
f0666b1ac8
@@ -466,6 +466,7 @@ void ceph_key_destroy(struct key *key) {
|
||||
struct ceph_crypto_key *ckey = key->payload.data;
|
||||
|
||||
ceph_crypto_key_destroy(ckey);
|
||||
kfree(ckey);
|
||||
}
|
||||
|
||||
struct key_type key_type_ceph = {
|
||||
|
Reference in New Issue
Block a user