summaryrefslogtreecommitdiffstats
path: root/sys/fs/procfs
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2009-02-16 15:17:26 +0000
committerdes <des@FreeBSD.org>2009-02-16 15:17:26 +0000
commit30905a584587209ee82da31eb6a3ca7856659f89 (patch)
treeedd135c1c224ccb077e90eca1774a7cc9ceb5f4a /sys/fs/procfs
parent18ef459d66774facccee8961de0394ce9e7cb266 (diff)
downloadFreeBSD-src-30905a584587209ee82da31eb6a3ca7856659f89.zip
FreeBSD-src-30905a584587209ee82da31eb6a3ca7856659f89.tar.gz
Fix a logic bug that caused the pfs_attr method to be called only for
PFS_PROCDEP nodes. Submitted by: Andrew Brampton <brampton@gmail.com> MFC after: 2 weeks
Diffstat (limited to 'sys/fs/procfs')
-rw-r--r--sys/fs/procfs/procfs.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/fs/procfs/procfs.c b/sys/fs/procfs/procfs.c
index 26bd185..77d1dc6 100644
--- a/sys/fs/procfs/procfs.c
+++ b/sys/fs/procfs/procfs.c
@@ -99,7 +99,6 @@ procfs_docurproc(PFS_FILL_ARGS)
int
procfs_attr(PFS_ATTR_ARGS)
{
- PROC_LOCK_ASSERT(p, MA_OWNED);
/* XXX inefficient, split into separate functions */
if (strcmp(pn->pn_name, "ctl") == 0 ||
@@ -112,11 +111,12 @@ procfs_attr(PFS_ATTR_ARGS)
strcmp(pn->pn_name, "fpregs") == 0)
vap->va_mode = 0600;
- if ((p->p_flag & P_SUGID) && pn->pn_type != pfstype_procdir)
- vap->va_mode = 0;
+ if (p != NULL) {
+ PROC_LOCK_ASSERT(p, MA_OWNED);
- vap->va_uid = p->p_ucred->cr_uid;
- vap->va_gid = p->p_ucred->cr_gid;
+ if ((p->p_flag & P_SUGID) && pn->pn_type != pfstype_procdir)
+ vap->va_mode = 0;
+ }
return (0);
}
OpenPOWER on IntegriCloud