summaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_file.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2000-12-15 19:41:27 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2000-12-15 19:41:27 +0000
commit216af8221ed4f3da2df4de2c799f80ebdee0dd39 (patch)
tree746ca89c538ca292e1f2c1d63c33b98f06bbf034 /sys/compat/linux/linux_file.c
parent48ecc0129d60b7b3049cbf425f004c9532695606 (diff)
Notes
Diffstat (limited to 'sys/compat/linux/linux_file.c')
-rw-r--r--sys/compat/linux/linux_file.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index d0e531b4ff16..1bbe4cc04536 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -124,14 +124,17 @@ linux_open(struct proc *p, struct linux_open_args *args)
bsd_open_args.mode = args->mode;
error = open(p, &bsd_open_args);
+ PROC_LOCK(p);
if (!error && !(bsd_open_args.flags & O_NOCTTY) &&
SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
struct filedesc *fdp = p->p_fd;
struct file *fp = fdp->fd_ofiles[p->p_retval[0]];
+ PROC_UNLOCK(p);
if (fp->f_type == DTYPE_VNODE)
fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, p);
- }
+ } else
+ PROC_UNLOCK(p);
#ifdef DEBUG
printf("Linux-emul(%d): open returns error %d\n",
p->p_pid, error);
@@ -402,6 +405,7 @@ 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",
@@ -419,7 +423,13 @@ linux_getdents(struct proc *p, struct linux_getdents_args *args)
if (vp->v_type != VDIR)
return (EINVAL);
- if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p))) {
+ PROC_LOCK(p);
+ uc = p->p_ucred;
+ crhold(uc);
+ PROC_UNLOCK(p);
+ error = VOP_GETATTR(vp, &va, uc, p);
+ crfree(uc);
+ if (error) {
return error;
}