summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/linux_file.c9
-rw-r--r--sys/compat/linux/linux_misc.c22
-rw-r--r--sys/compat/linux/linux_util.c13
3 files changed, 9 insertions, 35 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 1bbe4cc..4736ddc 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -405,7 +405,6 @@ linux_getdents(struct proc *p, struct linux_getdents_args *args)
int buflen, error, eofflag, nbytes, justone;
u_long *cookies = NULL, *cookiep;
int ncookies;
- struct ucred *uc;
#ifdef DEBUG
printf("Linux-emul(%d): getdents(%d, *, %d)\n",
@@ -423,13 +422,7 @@ linux_getdents(struct proc *p, struct linux_getdents_args *args)
if (vp->v_type != VDIR)
return (EINVAL);
- PROC_LOCK(p);
- uc = p->p_ucred;
- crhold(uc);
- PROC_UNLOCK(p);
- error = VOP_GETATTR(vp, &va, uc, p);
- crfree(uc);
- if (error) {
+ if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p))) {
return error;
}
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 10eaa6e..0caff43 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -185,7 +185,6 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
struct vnode *vp;
struct exec *a_out;
struct vattr attr;
- struct ucred *uc;
vm_offset_t vmaddr;
unsigned long file_offset;
vm_offset_t buffer;
@@ -237,21 +236,14 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
/*
* Executable?
*/
- PROC_LOCK(p);
- uc = p->p_ucred;
- crhold(uc);
- PROC_UNLOCK(p);
- error = VOP_GETATTR(vp, &attr, uc, p);
- if (error) {
- crfree(uc);
+ error = VOP_GETATTR(vp, &attr, p->p_ucred, p);
+ if (error)
goto cleanup;
- }
if ((vp->v_mount->mnt_flag & MNT_NOEXEC) ||
((attr.va_mode & 0111) == 0) ||
(attr.va_type != VREG)) {
error = ENOEXEC;
- crfree(uc);
goto cleanup;
}
@@ -260,21 +252,17 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
*/
if (attr.va_size == 0) {
error = ENOEXEC;
- crfree(uc);
goto cleanup;
}
/*
* Can we access it?
*/
- error = VOP_ACCESS(vp, VEXEC, uc, p);
- if (error) {
- crfree(uc);
+ error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p);
+ if (error)
goto cleanup;
- }
- error = VOP_OPEN(vp, FREAD, uc, p);
- crfree(uc);
+ error = VOP_OPEN(vp, FREAD, p->p_ucred, p);
if (error)
goto cleanup;
diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c
index f4fe8d7..6399805 100644
--- a/sys/compat/linux/linux_util.c
+++ b/sys/compat/linux/linux_util.c
@@ -62,7 +62,6 @@ 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;
@@ -141,18 +140,12 @@ linux_emul_find(p, sgp, prefix, path, pbuf, cflag)
return error;
}
- 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);
+ if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) {
goto bad;
}
- error = VOP_GETATTR(ndroot.ni_vp, &vatroot, uc, p);
- crfree(uc);
- if (error != 0) {
+ if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, p))
+ != 0) {
goto bad;
}
OpenPOWER on IntegriCloud