diff mbox series

crypto: sun8i-ss - fix infinite loop in sun8i_ss_setup_ivs()

Message ID 1654885635-32290-1-git-send-email-khoroshilov@ispras.ru
State Accepted
Commit d61a7b3decf7f0cf4121a7204303deefd2c7151b
Headers show
Series crypto: sun8i-ss - fix infinite loop in sun8i_ss_setup_ivs() | expand

Commit Message

Alexey Khoroshilov June 10, 2022, 6:27 p.m. UTC
There is no i decrement in while (i >= 0) loop.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Fixes: 359e893e8af4 ("crypto: sun8i-ss - rework handling of IV")
---
 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Herbert Xu June 17, 2022, 9:25 a.m. UTC | #1
On Fri, Jun 10, 2022 at 09:27:15PM +0300, Alexey Khoroshilov wrote:
> There is no i decrement in while (i >= 0) loop.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> Fixes: 359e893e8af4 ("crypto: sun8i-ss - rework handling of IV")
> ---
>  drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 1 +
>  1 file changed, 1 insertion(+)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
index 5bb950182026..910d6751644c 100644
--- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
+++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c
@@ -170,6 +170,7 @@  static int sun8i_ss_setup_ivs(struct skcipher_request *areq)
 	while (i >= 0) {
 		dma_unmap_single(ss->dev, rctx->p_iv[i], ivsize, DMA_TO_DEVICE);
 		memzero_explicit(sf->iv[i], ivsize);
+		i--;
 	}
 	return err;
 }