[LTP] [PATCH 2/2] af_alg08: Allow recv() to return EINVAL

Martin Doucha mdoucha@suse.cz
Tue May 12 18:27:17 CEST 2026


Recent kernels return EBADMSG from recv() when the crypto operation
fails. However, older kernels return EINVAL instead. Accept both
errno values.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/crypto/af_alg08.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/crypto/af_alg08.c b/testcases/kernel/crypto/af_alg08.c
index 5e04b579c..937ab1758 100644
--- a/testcases/kernel/crypto/af_alg08.c
+++ b/testcases/kernel/crypto/af_alg08.c
@@ -60,6 +60,10 @@ static int algfd = -1;
 static int reqfd = -1;
 static int pipefd[2] = { -1, -1 };
 static int file_fd = -1;
+static const int exp_errnos[] = {
+	EBADMSG,
+	EINVAL
+};
 
 static void try_corrupt(void)
 {
@@ -100,7 +104,8 @@ static void try_corrupt(void)
 	SAFE_SPLICE(pipefd[0], NULL, reqfd, NULL, OVERWRITE_SIZE, 0);
 
 	/* Expected to fail (invalid ciphertext); triggers the scratch write */
-	TST_EXP_FAIL_SILENT(recv(reqfd, recvbuf, sizeof(recvbuf), 0), EBADMSG);
+	TST_EXP_FAIL_ARR_SILENT(recv(reqfd, recvbuf, sizeof(recvbuf), 0),
+		exp_errnos, ARRAY_SIZE(exp_errnos));
 
 	SAFE_CLOSE(pipefd[0]);
 	SAFE_CLOSE(pipefd[1]);
-- 
2.53.0



More information about the ltp mailing list