Commit f9cac4fd authored by Heiko Carstens's avatar Heiko Carstens Committed by Vasily Gorbik

s390/pkey: fix memory leak within _copy_apqns_from_user()

Fixes: f2bbc96e ("s390/pkey: add CCA AES cipher key support")
Reported-by: default avatarMarkus Elfring <Markus.Elfring@web.de>
Reported-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 4ff4ba15
...@@ -740,8 +740,10 @@ static void *_copy_apqns_from_user(void __user *uapqns, size_t nr_apqns) ...@@ -740,8 +740,10 @@ static void *_copy_apqns_from_user(void __user *uapqns, size_t nr_apqns)
kapqns = kmalloc(nbytes, GFP_KERNEL); kapqns = kmalloc(nbytes, GFP_KERNEL);
if (!kapqns) if (!kapqns)
return ERR_PTR(-ENOMEM); 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 ERR_PTR(-EFAULT);
}
} }
return kapqns; return kapqns;
......
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