In lookup, when checking for procfs process node validity, target the
process we're trying to get information about through procfs, not the caller of lookup. fixes 'ls -l /proc/*/file' panic, which would occur when trying to lookup "file" for a kernel thread, which doesn't have p->p_textvp.
This commit is contained in:
parent
32a80e5d97
commit
85cb1a4957
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: procfs_vnops.c,v 1.147 2007/02/15 15:35:45 ad Exp $ */
|
||||
/* $NetBSD: procfs_vnops.c,v 1.148 2007/02/16 21:37:56 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -112,7 +112,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.147 2007/02/15 15:35:45 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.148 2007/02/16 21:37:56 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -1003,8 +1003,9 @@ procfs_lookup(v)
|
|||
pt = &proc_root_targets[i];
|
||||
if (cnp->cn_namelen == pt->pt_namlen &&
|
||||
memcmp(pt->pt_name, pname, cnp->cn_namelen) == 0 &&
|
||||
(pt->pt_valid == NULL ||
|
||||
(*pt->pt_valid)(cnp->cn_lwp, dvp->v_mount)))
|
||||
(pt->pt_valid == NULL || (p != NULL &&
|
||||
(*pt->pt_valid)(LIST_FIRST(&p->p_lwps),
|
||||
dvp->v_mount))))
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1054,8 +1055,9 @@ procfs_lookup(v)
|
|||
for (pt = proc_targets, i = 0; i < nproc_targets; pt++, i++) {
|
||||
if (cnp->cn_namelen == pt->pt_namlen &&
|
||||
memcmp(pt->pt_name, pname, cnp->cn_namelen) == 0 &&
|
||||
(pt->pt_valid == NULL ||
|
||||
(*pt->pt_valid)(cnp->cn_lwp, dvp->v_mount)))
|
||||
(pt->pt_valid == NULL || (p != NULL &&
|
||||
(*pt->pt_valid)(LIST_FIRST(&p->p_lwps),
|
||||
dvp->v_mount))))
|
||||
break;
|
||||
}
|
||||
if (i == nproc_targets) {
|
||||
|
|
Loading…
Reference in New Issue