Skip to content

Commit a84a921

Browse files
Alan Coxdhowells
authored andcommitted
key: Fix resource leak
On an error iov may still have been reallocated and need freeing Signed-off-by: Alan Cox <[email protected]> Signed-off-by: David Howells <[email protected]>
1 parent 6315277 commit a84a921

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

security/keys/keyctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,12 +1112,12 @@ long keyctl_instantiate_key_iov(key_serial_t id,
11121112
ret = rw_copy_check_uvector(WRITE, _payload_iov, ioc,
11131113
ARRAY_SIZE(iovstack), iovstack, &iov);
11141114
if (ret < 0)
1115-
return ret;
1115+
goto err;
11161116
if (ret == 0)
11171117
goto no_payload_free;
11181118

11191119
ret = keyctl_instantiate_key_common(id, iov, ioc, ret, ringid);
1120-
1120+
err:
11211121
if (iov != iovstack)
11221122
kfree(iov);
11231123
return ret;

0 commit comments

Comments
 (0)