Module Name: src
Committed By: riastradh
Date: Mon Dec 9 14:56:18 UTC 2019
Modified Files:
src/sys/arch/arm/sunxi: sun8i_crypto.c
Log Message:
Make sure ERESTART doesn't come flying out to userland.
I picked ERESTART to mean `all channels are occupied' because that's
what opencrypto(9) uses to decide whether to queue a request, but
it's not appropriate for sysctl(2) to return that.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/sun8i_crypto.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/sunxi/sun8i_crypto.c
diff -u src/sys/arch/arm/sunxi/sun8i_crypto.c:1.3 src/sys/arch/arm/sunxi/sun8i_crypto.c:1.4
--- src/sys/arch/arm/sunxi/sun8i_crypto.c:1.3 Mon Dec 9 14:56:06 2019
+++ src/sys/arch/arm/sunxi/sun8i_crypto.c Mon Dec 9 14:56:18 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_crypto.c,v 1.3 2019/12/09 14:56:06 riastradh Exp $ */
+/* $NetBSD: sun8i_crypto.c,v 1.4 2019/12/09 14:56:18 riastradh Exp $ */
/*-
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.3 2019/12/09 14:56:06 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.4 2019/12/09 14:56:18 riastradh Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -1232,8 +1232,11 @@ sun8i_crypto_sysctl_rng(SYSCTLFN_ARGS)
/* Submit the TRNG task. */
error = sun8i_crypto_submit_trng(sc, req->cu_task, size);
- if (error)
+ if (error) {
+ if (error == ERESTART)
+ error = EBUSY;
goto out2;
+ }
/* Wait for the request to complete. */
mutex_enter(&req->cu_lock);