crypto: testmgr - don't DMA map IV from stack in test_skcipher()
Subsystems (2)
PATCH 1/1 crypto: testmgr - don't DMA map IV from stack in test_skcipher()
Fix the "DMA-API: device driver maps memory from stack" warning generated when crypto accelerators map the IV.
--- crypto/testmgr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
crypto/testmgr.c +6 -1
@@ -1081,12 +1081,16 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,const char *e, *d;struct tcrypt_result result;void *data; -char iv[MAX_IVLEN ]; +char *iv;char *xbuf[XBUFSIZE ];char *xoutbuf[XBUFSIZE ];int ret = -ENOMEM ;unsigned int ivsize =crypto_skcipher_ivsize (tfm); + iv =kmalloc (MAX_IVLEN ,GFP_KERNEL ); +if (!iv) +return ret; +if (testmgr_alloc_buf (xbuf)) goto out_nobuf;
@@ -1328,6 +1332,7 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc, out_nooutbuf:testmgr_free_buf (xbuf); out_nobuf: +kfree (iv);return ret; }
Signature · 1 line
2.4.4
Herbert Xu
maintainerQuoted 4 lines · Horia Geantă
Fix the "DMA-API: device driver maps memory from stack" warning generated when crypto accelerators map the IV.
Signed-off-by Horia Geantă <[email protected]>
Hmm, the IV comes in as a pointer. So you should not assume that it can be DMAed at all.
Perhaps we should change the API so that it gets passed in as an SG list.
Cheers,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Quoted 9 lines · Herbert Xu
Quoted 4 lines · Horia Geantă
Fix the "DMA-API: device driver maps memory from stack" warning generated when crypto accelerators map the IV.
Signed-off-by Horia Geantă <[email protected]>Hmm, the IV comes in as a pointer. So you should not assume that it can be DMAed at all.
That's correct, thanks for pointing it out.
Quoted 3 lines
Perhaps we should change the API so that it gets passed in as an SG list.
Since changing the API and converting the users looks pretty lengthy, would it be acceptable to fix tcrypt for now?
Indeed, I've missed updating test_skcipher_speed, I can add this in v2.
Thanks,
Horia
Herbert Xu
maintainerQuoted 4 lines · Horia Geantă
Since changing the API and converting the users looks pretty lengthy, would it be acceptable to fix tcrypt for now?
Indeed, I've missed updatingtest_skcipher_speed, I can add this in v2.
Might as well leave it there because at least it reminds us to fix the problem. With the API as it is any new kernel user could potentially provide us with an IV off the stack.
Cheers,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt