diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-07-04 12:52:49 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-07-04 12:52:49 +0000 |
commit | b0b306fa18e54097784fd377171d7262782602ee (patch) | |
tree | 3bbd52b3df65067ea2939d05fc60c377ecd4c0b4 /sys/kern/uipc_socket2.c | |
parent | fbf625ad7cbebcebd74840e6e61c6df9e6bf5d1d (diff) |
Assert that the socket lock is held when `so_state' is modified.
ok bluhm@, visa@
Diffstat (limited to 'sys/kern/uipc_socket2.c')
-rw-r--r-- | sys/kern/uipc_socket2.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index d8fc578817d..15f1a7fd50f 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket2.c,v 1.81 2017/07/04 12:51:18 mpi Exp $ */ +/* $OpenBSD: uipc_socket2.c,v 1.82 2017/07/04 12:52:48 mpi Exp $ */ /* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */ /* @@ -89,7 +89,7 @@ int sbsleep(struct sockbuf *, struct rwlock *); void soisconnecting(struct socket *so) { - + soassertlocked(so); so->so_state &= ~(SS_ISCONNECTED|SS_ISDISCONNECTING); so->so_state |= SS_ISCONNECTING; } @@ -99,6 +99,7 @@ soisconnected(struct socket *so) { struct socket *head = so->so_head; + soassertlocked(so); so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING); so->so_state |= SS_ISCONNECTED; if (head && soqremque(so, 0)) { @@ -115,7 +116,7 @@ soisconnected(struct socket *so) void soisdisconnecting(struct socket *so) { - + soassertlocked(so); so->so_state &= ~SS_ISCONNECTING; so->so_state |= (SS_ISDISCONNECTING|SS_CANTRCVMORE|SS_CANTSENDMORE); wakeup(&so->so_timeo); @@ -126,7 +127,7 @@ soisdisconnecting(struct socket *so) void soisdisconnected(struct socket *so) { - + soassertlocked(so); so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING); so->so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE|SS_ISDISCONNECTED); wakeup(&so->so_timeo); @@ -261,7 +262,7 @@ soqremque(struct socket *so, int q) void socantsendmore(struct socket *so) { - + soassertlocked(so); so->so_state |= SS_CANTSENDMORE; sowwakeup(so); } @@ -269,7 +270,7 @@ socantsendmore(struct socket *so) void socantrcvmore(struct socket *so) { - + soassertlocked(so); so->so_state |= SS_CANTRCVMORE; sorwakeup(so); } |