summaryrefslogtreecommitdiffstats
path: root/net/ceph/crypto.h
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2012-08-02 18:12:59 +0200
committerSage Weil <sage@inktank.com>2012-08-02 18:19:20 +0200
commitf0666b1ac875ff32fe290219b150ec62eebbe10e (patch)
tree9f38d4c5ac83b77812692ccd2db6a880bf63cf9d /net/ceph/crypto.h
parentceph: simplify+fix atomic_open (diff)
downloadlinux-f0666b1ac875ff32fe290219b150ec62eebbe10e.tar.xz
linux-f0666b1ac875ff32fe290219b150ec62eebbe10e.zip
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>
Diffstat (limited to '')
-rw-r--r--net/ceph/crypto.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ceph/crypto.h b/net/ceph/crypto.h
index 1919d1550d75..3572dc518bc9 100644
--- a/net/ceph/crypto.h
+++ b/net/ceph/crypto.h
@@ -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,