[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200116164300.6705-131-sashal@kernel.org>
Date: Thu, 16 Jan 2020 11:41:46 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Heiko Carstens <heiko.carstens@...ibm.com>,
Markus Elfring <Markus.Elfring@....de>,
Christian Borntraeger <borntraeger@...ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Sasha Levin <sashal@...nel.org>, linux-s390@...r.kernel.org
Subject: [PATCH AUTOSEL 5.4 131/205] s390/pkey: fix memory leak within _copy_apqns_from_user()
From: Heiko Carstens <heiko.carstens@...ibm.com>
[ Upstream commit f9cac4fd8878929c6ebff0bd272317905d77c38a ]
Fixes: f2bbc96e7cfad ("s390/pkey: add CCA AES cipher key support")
Reported-by: Markus Elfring <Markus.Elfring@....de>
Reported-by: Christian Borntraeger <borntraeger@...ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@...ibm.com>
Signed-off-by: Vasily Gorbik <gor@...ux.ibm.com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/s390/crypto/pkey_api.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
index 9de3d46b3253..e17fac20127e 100644
--- a/drivers/s390/crypto/pkey_api.c
+++ b/drivers/s390/crypto/pkey_api.c
@@ -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;
--
2.20.1
Powered by blists - more mailing lists