diff options
author | Dmitry Torokhov | 2017-09-04 18:22:54 +0200 |
---|---|---|
committer | Dmitry Torokhov | 2017-09-04 18:22:54 +0200 |
commit | a6cbfa1e6d38c4b3ab0ce7e3aea4bb4e744f24b8 (patch) | |
tree | 8960e571a398b5d32e72bdb9c89ce965daa870ab /security/keys/keyctl.c | |
parent | Input: xpad - fix PowerA init quirk for some gamepad models (diff) | |
parent | Input: byd - make array seq static, reduces object code size (diff) | |
download | kernel-qcow2-linux-a6cbfa1e6d38c4b3ab0ce7e3aea4bb4e744f24b8.tar.gz kernel-qcow2-linux-a6cbfa1e6d38c4b3ab0ce7e3aea4bb4e744f24b8.tar.xz kernel-qcow2-linux-a6cbfa1e6d38c4b3ab0ce7e3aea4bb4e744f24b8.zip |
Merge branch 'next' into for-linus
Prepare input updates for 4.14 merge window.
Diffstat (limited to 'security/keys/keyctl.c')
-rw-r--r-- | security/keys/keyctl.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index 447a7d5cee0f..ab0b337c84b4 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c @@ -99,7 +99,7 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type, /* pull the payload in if one was supplied */ payload = NULL; - if (_payload) { + if (plen) { ret = -ENOMEM; payload = kvmalloc(plen, GFP_KERNEL); if (!payload) @@ -132,7 +132,10 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type, key_ref_put(keyring_ref); error3: - kvfree(payload); + if (payload) { + memzero_explicit(payload, plen); + kvfree(payload); + } error2: kfree(description); error: @@ -324,7 +327,7 @@ long keyctl_update_key(key_serial_t id, /* pull the payload in if one was supplied */ payload = NULL; - if (_payload) { + if (plen) { ret = -ENOMEM; payload = kmalloc(plen, GFP_KERNEL); if (!payload) @@ -347,7 +350,7 @@ long keyctl_update_key(key_serial_t id, key_ref_put(key_ref); error2: - kfree(payload); + kzfree(payload); error: return ret; } @@ -1093,7 +1096,10 @@ long keyctl_instantiate_key_common(key_serial_t id, keyctl_change_reqkey_auth(NULL); error2: - kvfree(payload); + if (payload) { + memzero_explicit(payload, plen); + kvfree(payload); + } error: return ret; } |