stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers3@gmail.com>
To: Gilad Ben-Yossef <gilad@benyossef.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Jonathan Corbet <corbet@lwn.net>,
	David Howells <dhowells@redhat.com>,
	Ofir Drang <ofir.drang@arm.com>,
	Gilad Ben-Yossef <gilad.benyossef@arm.com>,
	stable@vger.kernel.org, linux-crypto@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	keyrings@vger.kernel.org
Subject: Re: [PATCH 2/4] crypto: drbg wait for crypto op not signal safe
Date: Tue, 16 May 2017 15:39:46 -0700	[thread overview]
Message-ID: <20170516223946.GC113464@gmail.com> (raw)
In-Reply-To: <1494503626-15877-3-git-send-email-gilad@benyossef.com>

Hi Gilad,

On Thu, May 11, 2017 at 02:53:43PM +0300, Gilad Ben-Yossef wrote:
> drbg_kcapi_sym_ctr() was using wait_for_completion_interruptible() to
> wait for completion of async crypto op but if a signal occurs it
> may return before DMA ops of HW crypto provider finish, thus
> corrupting the output buffer.
> 
> Resolve this by using wait_for_completion() instead.
> 
> Reported-by: Eric Biggers <ebiggers3@gmail.com>
> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
> CC: stable@vger.kernel.org
> ---
>  crypto/drbg.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/crypto/drbg.c b/crypto/drbg.c
> index fa749f4..fa9054d 100644
> --- a/crypto/drbg.c
> +++ b/crypto/drbg.c
> @@ -1767,8 +1767,7 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
>  			break;
>  		case -EINPROGRESS:
>  		case -EBUSY:
> -			ret = wait_for_completion_interruptible(
> -				&drbg->ctr_completion);
> +			ret = wait_for_completion(&drbg->ctr_completion);
>  			if (!ret && !drbg->ctr_async_err) {
>  				reinit_completion(&drbg->ctr_completion);
>  				break;
> -- 

wait_for_completion() doesn't return a value.  This was fixed in the next patch,
but it should be done in this patch.

Eric

  reply	other threads:[~2017-05-16 22:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11 11:53 [PATCH 0/4] crypto: async crypto op fixes Gilad Ben-Yossef
2017-05-11 11:53 ` [PATCH 1/4] crypto: handle EBUSY due to backlog correctly Gilad Ben-Yossef
2017-05-11 11:53 ` [PATCH 2/4] crypto: drbg wait for crypto op not signal safe Gilad Ben-Yossef
2017-05-16 22:39   ` Eric Biggers [this message]
2017-05-18  5:09   ` Herbert Xu
2017-05-18  9:23     ` Gilad Ben-Yossef
2017-05-11 11:53 ` [PATCH 3/4] crypto: gcm " Gilad Ben-Yossef

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=20170516223946.GC113464@gmail.com \
    --to=ebiggers3@gmail.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=gilad.benyossef@arm.com \
    --cc=gilad@benyossef.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ofir.drang@arm.com \
    --cc=stable@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).