linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Harald Freudenberger <freude@linux.vnet.ibm.com>,
	"David S. Miller" <davem@davemloft.net>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linux-crypto@vger.kernel.org, linux-s390@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] s390/crypto: unlock on error in prng_tdes_read()
Date: Fri, 18 Nov 2016 13:12:47 +0100	[thread overview]
Message-ID: <20161118131247.44a52270@mschwide> (raw)
In-Reply-To: <20161118105451.GA26523@mwanda>

On Fri, 18 Nov 2016 14:11:00 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> 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;
> 

Nice spotting, I will add this to my fixes tree. Thank you..

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.


      reply	other threads:[~2016-11-18 12:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=20161118131247.44a52270@mschwide \
    --to=schwidefsky@de.ibm.com \
    --cc=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 \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).