aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/omap-sham.c
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 22:03:41 +1000
commit63832a0c6fe180aa34d2a77052aa501be6281c99 (patch)
tree6e49fc660e4d244dc52cbc39ab3972869022186e /drivers/crypto/omap-sham.c
parentcrypto: omap-sham - huge buffer access fixes (diff)
downloadlinux-dev-63832a0c6fe180aa34d2a77052aa501be6281c99.tar.xz
linux-dev-63832a0c6fe180aa34d2a77052aa501be6281c99.zip
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/omap-sham.c')
-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;