Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Stephan Mueller <smueller@chronox.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	Steffen Klassert <steffen.klassert@secunet.com>
Subject: Re: crypto: api - Change crypto_unregister_instance argument type
Date: Thu, 02 Apr 2015 17:13:23 +0200	[thread overview]
Message-ID: <8420276.vapgpo2qik@tauon> (raw)
In-Reply-To: <20150402145911.GA10227@gondor.apana.org.au>

Am Donnerstag, 2. April 2015, 22:59:11 schrieb Herbert Xu:

Hi Herbert,

>On Thu, Apr 02, 2015 at 04:54:03PM +0200, Stephan Mueller wrote:
>> >@@ -316,7 +316,7 @@ static int crypto_del_alg(struct sk_buff *skb, struct
>> >nlmsghdr *nlh, if (atomic_read(&alg->cra_refcnt) != 1)
>> >
>> > 		return -EBUSY;
>> >
>> >-	return crypto_unregister_instance(alg);
>> >+	return crypto_unregister_instance((struct crypto_instance *)alg);
>> 
>> Instead of using type casts, isn't container_of() a cleaner way (and
>> hopefully a safer way) of casting?
>
>Actually no that would only make sense if every alg sat within
>an instance which is not the case.  So I don't think using that
>would buy us much clarity.

In crypto_remove_instance, the code dereferences inst->tmpl. If you say that 
it is not guaranteed that the alg is always wrapped by an inst, wouldn't we 
have a potential invalid pointer?
>
>Thanks,


Ciao
Stephan

  reply	other threads:[~2015-04-02 15:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 14:31 crypto: api - Fix races in crypto_unregister_instance Herbert Xu
2015-04-02 14:39 ` crypto: api - Change crypto_unregister_instance argument type Herbert Xu
2015-04-02 14:54   ` Stephan Mueller
2015-04-02 14:59     ` Herbert Xu
2015-04-02 15:13       ` Stephan Mueller [this message]
2015-04-02 15:15         ` 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=8420276.vapgpo2qik@tauon \
    --to=smueller@chronox.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=steffen.klassert@secunet.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: 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