Fix a possible kernel memory leak - if the cmdline of a process was
requested after it had started to exit but before it became a zombie a page of kernel memory wouldn't be free'd.
This commit is contained in:
parent
dbbe2b1dd7
commit
ab92666f6b
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: procfs_cmdline.c,v 1.7 2000/05/16 13:45:25 simonb Exp $ */
|
||||
/* $NetBSD: procfs_cmdline.c,v 1.8 2000/06/01 13:43:08 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Jaromir Dolecek <dolecek@ics.muni.cz>
|
||||
@ -105,8 +105,10 @@ procfs_docmdline(curp, p, pfs, uio)
|
||||
* Lock the process down in memory.
|
||||
*/
|
||||
/* XXXCDC: how should locking work here? */
|
||||
if ((p->p_flag & P_WEXIT) || (p->p_vmspace->vm_refcnt < 1))
|
||||
if ((p->p_flag & P_WEXIT) || (p->p_vmspace->vm_refcnt < 1)) {
|
||||
free(arg, M_TEMP);
|
||||
return (EFAULT);
|
||||
}
|
||||
PHOLD(p);
|
||||
p->p_vmspace->vm_refcnt++; /* XXX */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user