summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-06-20 21:43:13 +0000
committerrwatson <rwatson@FreeBSD.org>2004-06-20 21:43:13 +0000
commitffabeb722910b0f8175a5d9e4005595590359ddc (patch)
tree56c66730ab5673379fad41e0d5044e11c5a63817
parentaf61e62dc913d0f8eb946f7223576ae4d3fdd550 (diff)
downloadFreeBSD-src-ffabeb722910b0f8175a5d9e4005595590359ddc.zip
FreeBSD-src-ffabeb722910b0f8175a5d9e4005595590359ddc.tar.gz
In uipc_rcvd(), lock the socket buffers at either end of the UNIX
domain sokcet when updating fields at both ends. Submitted by: sam Sponsored by: FreeBSD Foundation
-rw-r--r--sys/kern/uipc_usrreq.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 6de52dd..a5abcee 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -280,6 +280,8 @@ uipc_rcvd(struct socket *so, int flags)
if (unp->unp_conn == NULL)
break;
so2 = unp->unp_conn->unp_socket;
+ SOCKBUF_LOCK(&so2->so_snd);
+ SOCKBUF_LOCK(&so->so_rcv);
/*
* Adjust backpressure on sender
* and wakeup any waiting to write.
@@ -291,6 +293,8 @@ uipc_rcvd(struct socket *so, int flags)
(void)chgsbsize(so2->so_cred->cr_uidinfo, &so2->so_snd.sb_hiwat,
newhiwat, RLIM_INFINITY);
unp->unp_cc = so->so_rcv.sb_cc;
+ SOCKBUF_UNLOCK(&so->so_rcv);
+ SOCKBUF_UNLOCK(&so2->so_snd);
sowwakeup(so2);
break;
OpenPOWER on IntegriCloud