diff options
author | jhb <jhb@FreeBSD.org> | 2001-06-20 23:10:06 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-06-20 23:10:06 +0000 |
commit | 092b28a542eedc59fe825595f96f582c731b0f41 (patch) | |
tree | 0902e9ff433c027e741f2694b1a4a7af6faac89a /sys/kern/kern_proc.c | |
parent | c9fd5371494f6f8bf20195642f6a17f876c32708 (diff) | |
download | FreeBSD-src-092b28a542eedc59fe825595f96f582c731b0f41.zip FreeBSD-src-092b28a542eedc59fe825595f96f582c731b0f41.tar.gz |
Fix some lock order reversals where we called free() while holding a proc
lock. We now use temporary variables to save the process argument pointer
and just update the pointer while holding the lock. We then perform the
free on the cached pointer after releasing the lock.
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r-- | sys/kern/kern_proc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index f45ac26..883e2fa 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -709,10 +709,11 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS) return (error); PROC_LOCK(p); - if (p->p_args && --p->p_args->ar_ref == 0) - FREE(p->p_args, M_PARGS); + pa = p->p_args; p->p_args = NULL; PROC_UNLOCK(p); + if (pa != NULL && --pa->ar_ref == 0) + FREE(pa, M_PARGS); if (req->newlen + sizeof(struct pargs) > ps_arg_cache_limit) return (error); |