From 216af8221ed4f3da2df4de2c799f80ebdee0dd39 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 15 Dec 2000 19:41:27 +0000 Subject: Lock access to proc members. Glanced over by: marcel --- sys/compat/linux/linux_util.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sys/compat/linux/linux_util.c') diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c index 6399805a3037..f4fe8d7d4925 100644 --- a/sys/compat/linux/linux_util.c +++ b/sys/compat/linux/linux_util.c @@ -62,6 +62,7 @@ linux_emul_find(p, sgp, prefix, path, pbuf, cflag) struct nameidata ndroot; struct vattr vat; struct vattr vatroot; + struct ucred *uc; int error; char *ptr, *buf, *cp; size_t sz, len; @@ -140,12 +141,18 @@ linux_emul_find(p, sgp, prefix, path, pbuf, cflag) return error; } - if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) { + PROC_LOCK(p); + uc = p->p_ucred; + crhold(uc); + PROC_UNLOCK(p); + if ((error = VOP_GETATTR(nd.ni_vp, &vat, uc, p)) != 0) { + crfree(uc); goto bad; } - if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, p)) - != 0) { + error = VOP_GETATTR(ndroot.ni_vp, &vatroot, uc, p); + crfree(uc); + if (error != 0) { goto bad; } -- cgit v1.2.3