lkml.org 
[lkml]   [2009]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [BUGFIX for .32] crypto, gcm, fix another complete call in complete fuction
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


\
 
 \ /
  Last update: 2009-11-05 15:25    [W:0.043 / U:0.632 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site