summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-06-24 04:28:30 +0000
committerrwatson <rwatson@FreeBSD.org>2004-06-24 04:28:30 +0000
commit5b148b0cd40b22f7238cef6d2b77bde452dccc49 (patch)
tree5e648c26fbaf35735666411dae58a02bae589cf3 /sys/kern/uipc_socket.c
parent856e57e291cf451220a7c3a99ee6eafc5791133c (diff)
downloadFreeBSD-src-5b148b0cd40b22f7238cef6d2b77bde452dccc49.zip
FreeBSD-src-5b148b0cd40b22f7238cef6d2b77bde452dccc49.tar.gz
Lock socket buffers when processing setting socket options SO_SNDLOWAT
or SO_RCVLOWAT for read-modify-write.
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r--sys/kern/uipc_socket.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index fe99fe7..21ed076 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1495,14 +1495,18 @@ sosetopt(so, sopt)
* the high-water.
*/
case SO_SNDLOWAT:
+ SOCKBUF_LOCK(&so->so_snd);
so->so_snd.sb_lowat =
(optval > so->so_snd.sb_hiwat) ?
so->so_snd.sb_hiwat : optval;
+ SOCKBUF_UNLOCK(&so->so_snd);
break;
case SO_RCVLOWAT:
+ SOCKBUF_LOCK(&so->so_rcv);
so->so_rcv.sb_lowat =
(optval > so->so_rcv.sb_hiwat) ?
so->so_rcv.sb_hiwat : optval;
+ SOCKBUF_UNLOCK(&so->so_rcv);
break;
}
break;
OpenPOWER on IntegriCloud