diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index fa91a0c4c541..710ddd092d80 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -2180,8 +2180,10 @@ integer: goto integer; case SO_ERROR: + SOCK_LOCK(so); optval = so->so_error; so->so_error = 0; + SOCK_UNLOCK(so); goto integer; case SO_SNDBUF: