aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2012-09-28 12:20:02 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-28 12:06:04 -0700
commit8fc39830ce6dc2a93f29872afce83b180a6d3deb (patch)
treee94b4c6f9892de110a9a8362a2649f961fe04cca
parentd79c29b44524bd1ea8c4ab71a13f33fced3bb17a (diff)
key: Fix resource leak
commit a84a921978b7d56e0e4b87ffaca6367429b4d8ff upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 eca51918c95..9f9cc3af173 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -1067,12 +1067,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;