From: Herbert Xu <herbert@gondor.apana.org.au>
To: Huang Ying <ying.huang@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>
Subject: Re: [BUGFIX for .32] crypto, gcm, fix another complete call in complete fuction
Date: Thu, 5 Nov 2009 09:23:06 -0500 [thread overview]
Message-ID: <20091105142306.GA1910@gondor.apana.org.au> (raw)
In-Reply-To: <1257301423.22519.172.camel@yhuang-dev.sh.intel.com>
On Wed, Nov 04, 2009 at 10:23:43AM +0800, Huang Ying wrote:
>
> I have seen one example, in gcm_encrypt_done, which is called when
> encryption phase finished in asynchronous mode. The areq passed in may
> be in the context of pctx->u.abreq (due to cryptd etc). Then hash phase
> begin, and ghash is called, which operates on pctx->u.ahreq (share same
> memory of pctx->u.abreq) and its context. Now, *areq may be destroyed.
I see. Another way to handle this is to create a second function
for the completion functions that takes req->data directly rather
than dereferencing req again. Then you can simply call it directly
on the sync path.
Something like:
done2(struct aead_request *req, int err)
{
do real work
}
done(struct crypto_async_request *areq, int err)
{
done2(areq->data, err)
}
sync_path(struct crypto_async_request *areq, int err)
{
struct aead_request *req = areq->data;
if (!err) {
err = next_step(req);
if (err == -EINPROGRESS || err == -EBUSY)
return;
}
done2(req, err);
}
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
prev parent reply other threads:[~2009-11-05 14:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-03 2:40 [BUGFIX for .32] crypto, gcm, fix another complete call in complete fuction Huang Ying
2009-11-03 15:53 ` Herbert Xu
2009-11-04 2:23 ` Huang Ying
2009-11-05 14:23 ` Herbert Xu [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=20091105142306.GA1910@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ying.huang@intel.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