summaryrefslogtreecommitdiffstats
path: root/security/keys/keyctl.c
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2012-09-28 12:20:02 +0100
committerDavid Howells <dhowells@redhat.com>2012-09-28 12:20:02 +0100
commita84a921978b7d56e0e4b87ffaca6367429b4d8ff (patch)
tree03edfc3a5039edd443078d7adc20d585be89022b /security/keys/keyctl.c
parent631527703d1aa2f0c5dc2af0d998f4da95c83f0e (diff)
downloadop-kernel-dev-a84a921978b7d56e0e4b87ffaca6367429b4d8ff.zip
op-kernel-dev-a84a921978b7d56e0e4b87ffaca6367429b4d8ff.tar.gz
key: Fix resource leak
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>
Diffstat (limited to 'security/keys/keyctl.c')
-rw-r--r--security/keys/keyctl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 3364fbf..a0d373f 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -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;
OpenPOWER on IntegriCloud