summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2020-05-27 15:24:27 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2020-06-04 15:03:41 +0300
commit63832a0c6fe180aa34d2a77052aa501be6281c99 (patch)
tree6e49fc660e4d244dc52cbc39ab3972869022186e /drivers/crypto
parent6395166d7a19019d5e9574eb9ecdaf0028abb887 (diff)
downloadlinux-63832a0c6fe180aa34d2a77052aa501be6281c99.tar.xz
crypto: omap-sham - fix very small data size handling
With very small data sizes, the whole data can end up in the xmit buffer. This code path does not set the sg_len properly which causes the core dma framework to crash. Fix by adding the proper size in place. Also, the data length must be a multiple of block-size, so extend the DMA data size while here. Signed-off-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/omap-sham.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index 5efc66ccef46..45bc551ebc20 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -752,9 +752,11 @@ static int omap_sham_align_sgs(struct scatterlist *sg,
if (!sg || !sg->length || !nbytes) {
if (bufcnt) {
+ bufcnt = DIV_ROUND_UP(bufcnt, bs) * bs;
sg_init_table(rctx->sgl, 1);
sg_set_buf(rctx->sgl, rctx->dd->xmit_buf, bufcnt);
rctx->sg = rctx->sgl;
+ rctx->sg_len = 1;
}
return 0;