public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephan Mueller <smueller@chronox.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] crypto: remove instance when test failed
Date: Fri, 03 Apr 2015 17:17:13 +0200	[thread overview]
Message-ID: <1731327.mgbsjj4MeV@tachyon.chronox.de> (raw)
In-Reply-To: <20150403095828.GA19273@gondor.apana.org.au>

Am Freitag, 3. April 2015, 17:58:28 schrieb Herbert Xu:

Hi Herbert,

> On Thu, Apr 02, 2015 at 07:05:27PM +0200, Stephan Mueller wrote:
> > diff --git a/crypto/algapi.c b/crypto/algapi.c
> > index 83b04e0..215c604 100644
> > --- a/crypto/algapi.c
> > +++ b/crypto/algapi.c
> > 
> > @@ -545,6 +545,10 @@ unlock:
> >  		goto err;
> >  	
> >  	crypto_wait_for_test(larval);
> > 
> > +
> > +	/* Remove instance if test failed */
> > +	if (!(inst->alg.cra_flags & CRYPTO_ALG_TESTED))
> > +		crypto_unregister_instance(inst);
> 
> Unfortunately I don't think this is safe because the moment you
> release the mutex the instance can be freed.  So you'll need to
> hold a reference to it.
> 
> Cheers,

Wpuldn't crypto_del_alg suffer from the same issue? I see that the cra_refcnt 
is checked. But I guess there would be the same kind of race?

-- 
Ciao
Stephan

  reply	other threads:[~2015-04-03 15:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 17:05 [PATCH v2] crypto: remove instance when test failed Stephan Mueller
2015-04-03  9:58 ` Herbert Xu
2015-04-03 15:17   ` Stephan Mueller [this message]
2015-04-03 15:52     ` Herbert Xu
2015-04-03 19:29       ` Stephan Mueller
2015-04-06  4:45         ` Herbert Xu

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=1731327.mgbsjj4MeV@tachyon.chronox.de \
    --to=smueller@chronox.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@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