mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
libceph: fix crypto key null deref, memory leak
(cherry picked from commit f0666b1ac8
)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
59238927cc
commit
b8e03e320f
2 changed files with 3 additions and 1 deletions
|
@ -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 = {
|
||||
|
|
|
@ -16,7 +16,8 @@ struct ceph_crypto_key {
|
|||
|
||||
static inline void ceph_crypto_key_destroy(struct ceph_crypto_key *key)
|
||||
{
|
||||
kfree(key->key);
|
||||
if (key)
|
||||
kfree(key->key);
|
||||
}
|
||||
|
||||
extern int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
|
||||
|
|
Loading…
Reference in a new issue