Skip to content

Commit

Permalink
key: Fix resource leak
Browse files Browse the repository at this point in the history
On an error iov may still have been reallocated and need freeing

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: David Howells <dhowells@redhat.com>
  • Loading branch information
Alan Cox authored and David Howells committed Sep 28, 2012
1 parent 6315277 commit a84a921
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions security/keys/keyctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1112,12 +1112,12 @@ long keyctl_instantiate_key_iov(key_serial_t id,
ret = rw_copy_check_uvector(WRITE, _payload_iov, ioc,
ARRAY_SIZE(iovstack), iovstack, &iov);
if (ret < 0)
return ret;
goto err;
if (ret == 0)
goto no_payload_free;

ret = keyctl_instantiate_key_common(id, iov, ioc, ret, ringid);

err:
if (iov != iovstack)
kfree(iov);
return ret;
Expand Down

0 comments on commit a84a921

Please sign in to comment.