Commit d4ec1f18 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security

Pull key fix from James Morris.

Fix memory leak.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
  KEYS: ensure we free the assoc array edit if edit is valid
parents d61be4b3 ca4da5dd
...@@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring, ...@@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring) if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem); up_write(&keyring_serialise_link_sem);
if (edit && !edit->dead_leaf) { if (edit) {
key_payload_reserve(keyring, if (!edit->dead_leaf) {
keyring->datalen - KEYQUOTA_LINK_BYTES); key_payload_reserve(keyring,
keyring->datalen - KEYQUOTA_LINK_BYTES);
}
assoc_array_cancel_edit(edit); assoc_array_cancel_edit(edit);
} }
up_write(&keyring->sem); up_write(&keyring->sem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment