Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
Linus Torvalds committed Jul 28, 2015
2 parents d61be4b + ca4da5d commit d4ec1f1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions security/keys/keyring.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,9 +1181,11 @@ void __key_link_end(struct key *keyring,
if (index_key->type == &key_type_keyring)
up_write(&keyring_serialise_link_sem);

if (edit && !edit->dead_leaf) {
key_payload_reserve(keyring,
keyring->datalen - KEYQUOTA_LINK_BYTES);
if (edit) {
if (!edit->dead_leaf) {
key_payload_reserve(keyring,
keyring->datalen - KEYQUOTA_LINK_BYTES);
}
assoc_array_cancel_edit(edit);
}
up_write(&keyring->sem);
Expand Down

0 comments on commit d4ec1f1

Please sign in to comment.