diff options
author | 2013-01-15 11:12:57 +0000 | |
---|---|---|
committer | 2013-01-15 11:12:57 +0000 | |
commit | cfc885acd9c52055ae0e12d5f3079b453e5f54b6 (patch) | |
tree | 6eb80680266548bc7580c634634cdf3fb305f19c /sys/kern/sys_socket.c | |
parent | Process futex requeuing even when the thread times out or is signaled. (diff) | |
download | wireguard-openbsd-cfc885acd9c52055ae0e12d5f3079b453e5f54b6.tar.xz wireguard-openbsd-cfc885acd9c52055ae0e12d5f3079b453e5f54b6.zip |
Changing the socket buffer flags sb_flags was not interrupt safe
as |= and &= are non-atomic operations. To avoid additional locks,
put the flags that have to be accessed from interrupt into a separate
sb_flagsintr 32 bit integer field. sb_flagsintr is protected by
splsoftnet.
Input from miod@ deraadt@; OK deraadt@
Diffstat (limited to 'sys/kern/sys_socket.c')
-rw-r--r-- | sys/kern/sys_socket.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index d044ce1629b..5d28d6da66d 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_socket.c,v 1.14 2009/02/22 07:47:22 otto Exp $ */ +/* $OpenBSD: sys_socket.c,v 1.15 2013/01/15 11:12:57 bluhm Exp $ */ /* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */ /* @@ -150,11 +150,11 @@ soo_poll(struct file *fp, int events, struct proc *p) if (revents == 0) { if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { selrecord(p, &so->so_rcv.sb_sel); - so->so_rcv.sb_flags |= SB_SEL; + so->so_rcv.sb_flagsintr |= SB_SEL; } if (events & (POLLOUT | POLLWRNORM)) { selrecord(p, &so->so_snd.sb_sel); - so->so_snd.sb_flags |= SB_SEL; + so->so_snd.sb_flagsintr |= SB_SEL; } } splx(s); |