[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20091105142306.GA1910@gondor.apana.org.au>
Date: Thu, 5 Nov 2009 09:23:06 -0500
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Huang Ying <ying.huang@...el.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>
Subject: Re: [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@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists