From e8c22fe01c6dd46399396694cd1d72a6988dc287 Mon Sep 17 00:00:00 2001 From: Ondrej Mosnacek Date: Sat, 27 Mar 2021 13:46:45 +0100 Subject: [PATCH] kcapi: Fix hang in fuzz tests with recent kernels After kernel commit f3c802a1f300 ("crypto: algif_aead - Only wake up when..."), the fuzz tests hang indefinitely, because they request more output data than the operation can produce. Fix this by requesting at most the expected size of the output data. Signed-off-by: Ondrej Mosnacek --- test/kcapi-main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/kcapi-main.c b/test/kcapi-main.c index 64e466c..975e8d1 100644 --- a/test/kcapi-main.c +++ b/test/kcapi-main.c @@ -380,7 +380,7 @@ static int fuzz_cipher(struct kcapi_cavs *cavs_test, unsigned long flags, } for (i = 0; i < sizeof(indata); i++) { - unsigned int outlen = sizeof(outdata); + unsigned int outlen = i; uint8_t *out = outdata; uint8_t *iv = indata; uint8_t *in = indata; @@ -474,7 +474,7 @@ static int fuzz_aead(struct kcapi_cavs *cavs_test, unsigned long flags, } for (i = 0; i < sizeof(indata); i++) { - unsigned int outlen = sizeof(outdata); + unsigned int outlen = i; uint8_t *out = outdata; uint8_t *iv = indata; uint8_t *in = indata;