Patchwork [3.5.y.z,extended,stable] Patch "key: Fix resource leak" has been added to staging queue

mail settings
Submitter Luis Henriques
Date March 22, 2013, 10:07 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/229954/
State New
Headers show


Luis Henriques - March 22, 2013, 10:07 a.m.
This is a note to let you know that I have just added a patch titled

    key: Fix resource leak

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see



From 655eee49922e9ff6996fea8662e9e2ff83551316 Mon Sep 17 00:00:00 2001
From: Alan Cox <>
Date: Fri, 28 Sep 2012 12:20:02 +0100
Subject: [PATCH] key: Fix resource leak

commit a84a921978b7d56e0e4b87ffaca6367429b4d8ff upstream.

On an error iov may still have been reallocated and need freeing

Signed-off-by: Alan Cox <>
Signed-off-by: David Howells <>
Signed-off-by: Luis Henriques <>
 security/keys/keyctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 0f5b3f0..44d8758 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);
 	if (iov != iovstack)
 	return ret;