Re: [BUGFIX] dm-crypt: Fix a bug of async cryption complete function

2009-02-27 Thread Herbert Xu
On Fri, Feb 27, 2009 at 02:51:15PM +0100, Milan Broz wrote: > > Is the attached and reworked patch ok? Looks good to me. Thanks, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herber

Re: [BUGFIX] dm-crypt: Fix a bug of async cryption complete function

2009-02-27 Thread Milan Broz
Herbert Xu wrote: > On Fri, Feb 27, 2009 at 01:28:46PM +0100, Milan Broz wrote: >> Like this? >> >> struct ablkcipher_request *req = (char *)dmreq - cc->dmreq_start; >> mempool_free(req, cc->req_pool); > > Exactly. You could also embed the ablkcipher_request at the > end of dmreq, as in > > struct

Re: [BUGFIX] dm-crypt: Fix a bug of async cryption complete function

2009-02-27 Thread Herbert Xu
On Fri, Feb 27, 2009 at 01:28:46PM +0100, Milan Broz wrote: > > Like this? > > struct ablkcipher_request *req = (char *)dmreq - cc->dmreq_start; > mempool_free(req, cc->req_pool); Exactly. You could also embed the ablkcipher_request at the end of dmreq, as in struct dm_crypt_request { s

Re: [BUGFIX] dm-crypt: Fix a bug of async cryption complete function

2009-02-27 Thread Milan Broz
Herbert Xu wrote: > On Fri, Feb 27, 2009 at 12:52:05PM +0100, Milan Broz wrote: >> Herbert Xu wrote: >>> On Fri, Feb 27, 2009 at 04:56:11PM +0800, Huang Ying wrote: @@ -830,7 +838,7 @@ static void kcryptd_async_done(struct cr return; } - mempool_free(ablkci

Re: [BUGFIX] dm-crypt: Fix a bug of async cryption complete function

2009-02-27 Thread Herbert Xu
On Fri, Feb 27, 2009 at 12:52:05PM +0100, Milan Broz wrote: > Herbert Xu wrote: > > On Fri, Feb 27, 2009 at 04:56:11PM +0800, Huang Ying wrote: > >> @@ -830,7 +838,7 @@ static void kcryptd_async_done(struct cr > >>return; > >>} > >> > >> - mempool_free(ablkcipher_request_cast(asy

Re: [BUGFIX] dm-crypt: Fix a bug of async cryption complete function

2009-02-27 Thread Milan Broz
Herbert Xu wrote: > On Fri, Feb 27, 2009 at 04:56:11PM +0800, Huang Ying wrote: >> @@ -830,7 +838,7 @@ static void kcryptd_async_done(struct cr >> return; >> } >> >> -mempool_free(ablkcipher_request_cast(async_req), cc->req_pool); >> +mempool_free(dmreq->req, cc->req_poo

Re: [BUGFIX] dm-crypt: Fix a bug of async cryption complete function

2009-02-27 Thread Herbert Xu
On Fri, Feb 27, 2009 at 04:56:11PM +0800, Huang Ying wrote: > > @@ -830,7 +838,7 @@ static void kcryptd_async_done(struct cr > return; > } > > - mempool_free(ablkcipher_request_cast(async_req), cc->req_pool); > + mempool_free(dmreq->req, cc->req_pool); Why do we need

[BUGFIX] dm-crypt: Fix a bug of async cryption complete function

2009-02-27 Thread Huang Ying
In async cryption complete function (kcryptd_async_done), the crypto_async_request passed in may be different from the one passed to crypto_ablkcipher_encrypt/decrypt. Only crypto_async_request->data is guaranteed to be same as the passed in one. Current kcryptd_async_done uses passed in crypto_asy