Commit a84a9219 authored by Alan Cox's avatar Alan Cox Committed by David Howells

key: Fix resource leak

On an error iov may still have been reallocated and need freeing
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 63152770
...@@ -1112,12 +1112,12 @@ long keyctl_instantiate_key_iov(key_serial_t id, ...@@ -1112,12 +1112,12 @@ long keyctl_instantiate_key_iov(key_serial_t id,
ret = rw_copy_check_uvector(WRITE, _payload_iov, ioc, ret = rw_copy_check_uvector(WRITE, _payload_iov, ioc,
ARRAY_SIZE(iovstack), iovstack, &iov); ARRAY_SIZE(iovstack), iovstack, &iov);
if (ret < 0) if (ret < 0)
return ret; goto err;
if (ret == 0) if (ret == 0)
goto no_payload_free; goto no_payload_free;
ret = keyctl_instantiate_key_common(id, iov, ioc, ret, ringid); ret = keyctl_instantiate_key_common(id, iov, ioc, ret, ringid);
err:
if (iov != iovstack) if (iov != iovstack)
kfree(iov); kfree(iov);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment