Skip to content

Commit 182f16a

Browse files
tobluxgregkh
authored andcommitted
crypto: mxs-dcp - fix source scatterlist length access
commit c5bcb08 upstream. mxs_dcp_aes_block_crypt() uses sg_dma_len() without mapping the source scatterlist with dma_map_sg() first. Therefore, sg_dma_len() is invalid and could return zero or a stale DMA length, causing encryption and decryption to process the wrong number of bytes when CONFIG_NEED_SG_DMA_LENGTH=y. Use the original scatterlist length instead. Fixes: 15b59e7 ("crypto: mxs - Add Freescale MXS DCP driver") Cc: stable@vger.kernel.org Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2f65718 commit 182f16a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/crypto/mxs-dcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq)
353353

354354
for_each_sg(req->src, src, sg_nents(req->src), i) {
355355
src_buf = sg_virt(src);
356-
len = sg_dma_len(src);
356+
len = src->length;
357357
tlen += len;
358358
limit_hit = tlen > req->cryptlen;
359359

0 commit comments

Comments
 (0)