Commit 9e6e7c74 authored by Dan Carpenter's avatar Dan Carpenter Committed by Martin Schwidefsky

s390/crypto: unlock on error in prng_tdes_read()

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

Fixes: 57127645 ("s390/zcrypt: Introduce new SHA-512 based Pseudo Random Generator.")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent e32eae10
...@@ -507,8 +507,10 @@ static ssize_t prng_tdes_read(struct file *file, char __user *ubuf, ...@@ -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.byte_counter += n;
prng_data->prngws.reseed_counter += n; prng_data->prngws.reseed_counter += n;
if (copy_to_user(ubuf, prng_data->buf, chunk)) if (copy_to_user(ubuf, prng_data->buf, chunk)) {
return -EFAULT; ret = -EFAULT;
break;
}
nbytes -= chunk; nbytes -= chunk;
ret += chunk; ret += chunk;
......
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