linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] s390/crypto: unlock on error in prng_tdes_read()
@ 2016-11-18 11:11 Dan Carpenter
  2016-11-18 12:12 ` Martin Schwidefsky
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-11-18 11:11 UTC (permalink / raw)
  To: Herbert Xu, Harald Freudenberger
  Cc: David S. Miller, Martin Schwidefsky, Heiko Carstens, linux-crypto,
	linux-s390, kernel-janitors

We added some new locking but forgot to unlock on error.

Fixes: 57127645d79d ("s390/zcrypt: Introduce new SHA-512 based Pseudo Random Generator.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c
index 9cc050f..1113389 100644
--- a/arch/s390/crypto/prng.c
+++ b/arch/s390/crypto/prng.c
@@ -507,8 +507,10 @@ static ssize_t prng_tdes_read(struct file *file, char __user *ubuf,
 		prng_data->prngws.byte_counter += n;
 		prng_data->prngws.reseed_counter += n;
 
-		if (copy_to_user(ubuf, prng_data->buf, chunk))
-			return -EFAULT;
+		if (copy_to_user(ubuf, prng_data->buf, chunk)) {
+			ret = -EFAULT;
+			break;
+		}
 
 		nbytes -= chunk;
 		ret += chunk;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-18 12:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-18 11:11 [patch] s390/crypto: unlock on error in prng_tdes_read() Dan Carpenter
2016-11-18 12:12 ` Martin Schwidefsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).