diff options
| author | dsl <dsl@NetBSD.org> | 2007-02-17 21:40:19 +0000 |
|---|---|---|
| committer | dsl <dsl@NetBSD.org> | 2007-02-17 21:40:19 +0000 |
| commit | 2b491f69ce06e6d03bbb66b98f9aed2ecefd6012 (patch) | |
| tree | 41f87092bea4fe095f994e69fd52ff952a57689f /sys/compat/linux/common | |
| parent | 10c063a777cc81968f8c66f3a34d8f372aea72cd (diff) | |
Acquire proclist_lock across the calls to p_find() and pg_find().
Diffstat (limited to 'sys/compat/linux/common')
| -rw-r--r-- | sys/compat/linux/common/linux_file.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/compat/linux/common/linux_file.c b/sys/compat/linux/common/linux_file.c index 778ce492507..35d9517bd38 100644 --- a/sys/compat/linux/common/linux_file.c +++ b/sys/compat/linux/common/linux_file.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_file.c,v 1.77 2007/02/09 21:55:19 ad Exp $ */ +/* $NetBSD: linux_file.c,v 1.78 2007/02/17 21:40:19 dsl Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.77 2007/02/09 21:55:19 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.78 2007/02/17 21:40:19 dsl Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -461,18 +461,22 @@ linux_sys_fcntl(l, v, retval) retval[0] = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PGID; return 0; } + rw_enter(&proclist_lock, RW_READER); if ((long)arg <= 0) { pgid = -(long)arg; } else { - struct proc *p1 = pfind((long)arg); + struct proc *p1 = p_find((long)arg, PFIND_LOCKED | PFIND_UNLOCK_FAIL); if (p1 == NULL) return (ESRCH); pgid = (long)p1->p_pgrp->pg_id; } - pgrp = pgfind(pgid); - if (pgrp == NULL || pgrp->pg_session != p->p_session) + pgrp = pg_find(pgid, PFIND_LOCKED); + if (pgrp == NULL || pgrp->pg_session != p->p_session) { + rw_exit(&proclist_lock); return EPERM; + } tp->t_pgrp = pgrp; + rw_exit(&proclist_lock); return 0; default: |
