From: Dan Carpenter <dan.carpenter@oracle.com> To: Herbert Xu <herbert@gondor.apana.org.au>, Harald Freudenberger <freude@linux.vnet.ibm.com> Cc: "David S. Miller" <davem@davemloft.net>, Martin Schwidefsky <schwidefsky@de.ibm.com>, Heiko Carstens <heiko.carstens@de.ibm.com>, linux-crypto@vger.kernel.org, linux-s390@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] s390/crypto: unlock on error in prng_tdes_read() Date: Fri, 18 Nov 2016 14:11:00 +0300 [thread overview] Message-ID: <20161118105451.GA26523@mwanda> (raw) 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;
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com> To: Herbert Xu <herbert@gondor.apana.org.au>, Harald Freudenberger <freude@linux.vnet.ibm.com> Cc: "David S. Miller" <davem@davemloft.net>, Martin Schwidefsky <schwidefsky@de.ibm.com>, Heiko Carstens <heiko.carstens@de.ibm.com>, linux-crypto@vger.kernel.org, linux-s390@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] s390/crypto: unlock on error in prng_tdes_read() Date: Fri, 18 Nov 2016 11:11:00 +0000 [thread overview] Message-ID: <20161118105451.GA26523@mwanda> (raw) 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;
next reply other threads:[~2016-11-18 11:11 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-11-18 11:11 Dan Carpenter [this message] 2016-11-18 11:11 ` [patch] s390/crypto: unlock on error in prng_tdes_read() Dan Carpenter 2016-11-18 12:12 ` Martin Schwidefsky 2016-11-18 12:12 ` Martin Schwidefsky
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20161118105451.GA26523@mwanda \ --to=dan.carpenter@oracle.com \ --cc=davem@davemloft.net \ --cc=freude@linux.vnet.ibm.com \ --cc=heiko.carstens@de.ibm.com \ --cc=herbert@gondor.apana.org.au \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-crypto@vger.kernel.org \ --cc=linux-s390@vger.kernel.org \ --cc=schwidefsky@de.ibm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.