summaryrefslogtreecommitdiff
path: root/sys/kern/uipc_usrreq.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2004-01-06 04:18:19 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2004-01-06 04:18:19 +0000
commit24a4ca6116963009f48b3a9dc80fb2a91cf8f2d7 (patch)
tree1285534708b8e68ba728b789e5fe1de7515368dd /sys/kern/uipc_usrreq.c
parent0d7215348248eb63089dc73e3013c9379e5894a6 (diff)
lock filedesc before manipulating. avoids some rare races.
testing for quite some time by brad + otto
Diffstat (limited to 'sys/kern/uipc_usrreq.c')
-rw-r--r--sys/kern/uipc_usrreq.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 7ac3a42729c..af41b16a6ac 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_usrreq.c,v 1.24 2003/08/17 22:59:42 tedu Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.25 2004/01/06 04:18:18 tedu Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
@@ -656,6 +656,7 @@ unp_externalize(rights)
#endif
restart:
+ fdplock(p->p_fd, p);
if (error != 0) {
rp = ((struct file **)CMSG_DATA(cm));
for (i = 0; i < nfds; i++) {
@@ -696,6 +697,7 @@ restart:
*/
error = EMSGSIZE;
}
+ fdpunlock(p->p_fd);
goto restart;
}
@@ -726,6 +728,7 @@ restart:
cm->cmsg_len = CMSG_LEN(nfds * sizeof(int));
rights->m_len = CMSG_SPACE(nfds * sizeof(int));
out:
+ fdpunlock(p->p_fd);
free(fdp, M_TEMP);
return (error);
}