[LTP] [PATCH] af_alg08: Don't check recv() errno

Martin Doucha mdoucha@suse.cz
Tue May 12 14:49:06 CEST 2026


Recent kernels return EBADMSG from recv() when the crypto operation
fails. However, older kernels return EINVAL instead. Remove check
for specific errno and only check that recv() failed.

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

diff --git a/testcases/kernel/crypto/af_alg08.c b/testcases/kernel/crypto/af_alg08.c
index 5e04b579c..4cc3e5c4e 100644
--- a/testcases/kernel/crypto/af_alg08.c
+++ b/testcases/kernel/crypto/af_alg08.c
@@ -100,7 +100,14 @@ 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);
+	TEST(recv(reqfd, recvbuf, sizeof(recvbuf), 0));
+
+	if (TST_RET >= 0) {
+		tst_res(TFAIL, "Decryption succeeded unexpectedly");
+	} else if (TST_RET != -1) {
+		tst_res(TFAIL | TTERRNO, "Invalid recv() return value %ld",
+			TST_RET);
+	}
 
 	SAFE_CLOSE(pipefd[0]);
 	SAFE_CLOSE(pipefd[1]);
-- 
2.53.0



More information about the ltp mailing list