Re: [BUGFIX for .32] crypto, gcm, fix another complete call in complete fuction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>
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-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux