Skip to content

Commit

Permalink
s390/pkey: fix memory leak within _copy_apqns_from_user()
Browse files Browse the repository at this point in the history
Fixes: f2bbc96 ("s390/pkey: add CCA AES cipher key support")
Reported-by: Markus Elfring <[email protected]>
Reported-by: Christian Borntraeger <[email protected]>
Signed-off-by: Heiko Carstens <[email protected]>
Signed-off-by: Vasily Gorbik <[email protected]>
  • Loading branch information
heicarst authored and Vasily Gorbik committed Nov 12, 2019
1 parent 4ff4ba1 commit f9cac4f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/s390/crypto/pkey_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,10 @@ static void *_copy_apqns_from_user(void __user *uapqns, size_t nr_apqns)
kapqns = kmalloc(nbytes, GFP_KERNEL);
if (!kapqns)
return ERR_PTR(-ENOMEM);
if (copy_from_user(kapqns, uapqns, nbytes))
if (copy_from_user(kapqns, uapqns, nbytes)) {
kfree(kapqns);
return ERR_PTR(-EFAULT);
}
}

return kapqns;
Expand Down

0 comments on commit f9cac4f

Please sign in to comment.