diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2013-11-03 13:50:25 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2013-11-03 13:50:25 +0000 |
commit | 8f62496807c6e264110c22be6f07fe0b8ed84cca (patch) | |
tree | 16310ff262ab93212d28092ccd4f99d0d22f8682 /sys/nfs | |
parent | cbf0c91b0c8b7f9236c6e7c6d8c2dddcfdc0846c (diff) |
Fix bogus kthread_create() usage leading to wrong struct proc * pointer
usage in the nfs kthreads. Spotted by fgsch@, similar diff by guenther@,
ok guenther@
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_aiod.c | 8 | ||||
-rw-r--r-- | sys/nfs/nfs_syscalls.c | 7 |
2 files changed, 5 insertions, 10 deletions
diff --git a/sys/nfs/nfs_aiod.c b/sys/nfs/nfs_aiod.c index 3a9451b021d..ada3669560e 100644 --- a/sys/nfs/nfs_aiod.c +++ b/sys/nfs/nfs_aiod.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_aiod.c,v 1.4 2009/08/27 23:39:46 thib Exp $ */ +/* $OpenBSD: nfs_aiod.c,v 1.5 2013/11/03 13:50:24 miod Exp $ */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -72,11 +72,8 @@ nfs_aiod(void *arg) { struct nfs_aiod *aiod; struct nfsmount *nmp; - struct proc *p; struct buf *bp; - p = (struct proc *)arg; - aiod = malloc(sizeof(*aiod), M_TEMP, M_WAITOK|M_ZERO); mtx_enter(&nfs_aiodl_mtx); LIST_INSERT_HEAD(&nfs_aiods_all, aiod, nad_all); @@ -165,7 +162,6 @@ int nfs_set_naiod(int howmany) { struct nfs_aiod *aiod; - struct proc *p; int want, error; KASSERT(howmany >= 0); @@ -181,7 +177,7 @@ nfs_set_naiod(int howmany) /* Add more. */ want = min(want, NFS_MAXASYNCDAEMON); while (want > 0) { - error = kthread_create(nfs_aiod, p, &p, "nfsaio"); + error = kthread_create(nfs_aiod, NULL, NULL, "nfsaio"); if (error) return (error); want--; diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index 475caba0e64..af87e03e058 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_syscalls.c,v 1.95 2013/06/25 02:53:47 beck Exp $ */ +/* $OpenBSD: nfs_syscalls.c,v 1.96 2013/11/03 13:50:24 miod Exp $ */ /* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */ /* @@ -564,7 +564,7 @@ nfsrv_init(int terminating) void nfssvc_iod(void *arg) { - struct proc *p = (struct proc *)arg; + struct proc *p = curproc; struct buf *bp, *nbp; int i, myiod; struct vnode *vp; @@ -657,7 +657,6 @@ nfssvc_iod(void *arg) void nfs_getset_niothreads(int set) { - struct proc *p; int i, have, start; for (have = 0, i = 0; i < NFS_MAXASYNCDAEMON; i++) @@ -671,7 +670,7 @@ nfs_getset_niothreads(int set) start = nfs_niothreads - have; while (start > 0) { - kthread_create(nfssvc_iod, p, &p, "nfsio"); + kthread_create(nfssvc_iod, NULL, NULL, "nfsio"); start--; } |