summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjmg <jmg@FreeBSD.org>2004-03-10 00:27:36 +0000
committerjmg <jmg@FreeBSD.org>2004-03-10 00:27:36 +0000
commitcf1b8bdb72065fb64981ec1fea1d132eff6bf834 (patch)
tree90e335081c7672bb833484ea8908bdc0e561ee49 /sys/kern
parentee010adacbe1b9ec303be9465a250f9dfc55d593 (diff)
downloadFreeBSD-src-cf1b8bdb72065fb64981ec1fea1d132eff6bf834.zip
FreeBSD-src-cf1b8bdb72065fb64981ec1fea1d132eff6bf834.tar.gz
make sure we had the filedesc lock when calling fdinit when RFCFDG is set
on call to rfork. Submitted by: Brian Buchanan Semi-Reviewed by: rwatson
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_fork.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 34a1bfd..fd229c9 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -232,7 +232,9 @@ fork1(td, flags, pages, procp)
*/
if (flags & RFCFDG) {
struct filedesc *fdtmp;
+ FILEDESC_LOCK(td->td_proc->p_fd);
fdtmp = fdinit(td->td_proc->p_fd);
+ FILEDESC_UNLOCK(td->td_proc->p_fd);
fdfree(td);
p1->p_fd = fdtmp;
}
@@ -428,7 +430,9 @@ again:
* Copy filedesc.
*/
if (flags & RFCFDG) {
+ FILEDESC_LOCK(td->td_proc->p_fd);
fd = fdinit(td->td_proc->p_fd);
+ FILEDESC_UNLOCK(td->td_proc->p_fd);
fdtol = NULL;
} else if (flags & RFFDG) {
FILEDESC_LOCK(p1->p_fd);
OpenPOWER on IntegriCloud