* [PATCH] crypto: testmgr - don't DMA map IV from stack in test_skcipher()
@ 2017-01-13 6:59 Horia Geantă
2017-01-13 8:46 ` Herbert Xu
0 siblings, 1 reply; 4+ messages in thread
From: Horia Geantă @ 2017-01-13 6:59 UTC (permalink / raw)
To: Herbert Xu; +Cc: David S. Miller, linux-crypto
Fix the "DMA-API: device driver maps memory from stack" warning
generated when crypto accelerators map the IV.
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
---
crypto/testmgr.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 500a5277cc22..64245aeef634 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -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;
}
--
2.4.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: testmgr - don't DMA map IV from stack in test_skcipher()
2017-01-13 6:59 [PATCH] crypto: testmgr - don't DMA map IV from stack in test_skcipher() Horia Geantă
@ 2017-01-13 8:46 ` Herbert Xu
2017-03-08 13:04 ` Horia Geantă
0 siblings, 1 reply; 4+ messages in thread
From: Herbert Xu @ 2017-01-13 8:46 UTC (permalink / raw)
To: Horia Geantă; +Cc: David S. Miller, linux-crypto
On Fri, Jan 13, 2017 at 08:59:16AM +0200, Horia Geantă wrote:
> Fix the "DMA-API: device driver maps memory from stack" warning
> generated when crypto accelerators map the IV.
>
> Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
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,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: testmgr - don't DMA map IV from stack in test_skcipher()
2017-01-13 8:46 ` Herbert Xu
@ 2017-03-08 13:04 ` Horia Geantă
2017-03-09 4:18 ` Herbert Xu
0 siblings, 1 reply; 4+ messages in thread
From: Horia Geantă @ 2017-03-08 13:04 UTC (permalink / raw)
To: Herbert Xu; +Cc: David S. Miller, linux-crypto
On 1/13/2017 10:46 AM, Herbert Xu wrote:
> On Fri, Jan 13, 2017 at 08:59:16AM +0200, Horia Geantă wrote:
>> Fix the "DMA-API: device driver maps memory from stack" warning
>> generated when crypto accelerators map the IV.
>>
>> Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
>
> 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.
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-09 4:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 6:59 [PATCH] crypto: testmgr - don't DMA map IV from stack in test_skcipher() Horia Geantă
2017-01-13 8:46 ` Herbert Xu
2017-03-08 13:04 ` Horia Geantă
2017-03-09 4:18 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).