summaryrefslogtreecommitdiff
path: root/sys/kern/sys_socket.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2013-01-15 11:12:58 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2013-01-15 11:12:58 +0000
commitb2285ef6912c5da6b5afb247bbe6881eacf36761 (patch)
tree725a45f7fdf37b12d338f2f36e24823a527c3760 /sys/kern/sys_socket.c
parent33a4e21e5bc9b901acecda1a99b1779f3144526e (diff)
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.c6
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);