diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2011-07-05 00:38:00 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2011-07-05 00:38:00 +0000 |
commit | da436b0eb24917121d4e345abcd90b6dfd568d5b (patch) | |
tree | b519e1e603082d0faf47e119ceada33d0699e2fb /sys/nfs | |
parent | 81336eb02d81074d229f07375e36682eb266acac (diff) |
When calling nfs_request() for what could be an async request, pass
down curproc instead of the struct proc from the I/O request...which
may gone away behind our back. Assert that the supplied request
*is* curproc in a couple other places.
Reproduction and testing by sthen@
ok deraadt@, beck@, art@
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_vnops.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 0ddd9b33824..40dfa869db5 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.135 2011/07/04 21:00:10 deraadt Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.136 2011/07/05 00:37:59 guenther Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -997,7 +997,7 @@ nfs_readlinkrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred) info.nmi_mb = info.nmi_mreq = nfsm_reqhead(NFSX_FH(info.nmi_v3)); nfsm_fhtom(&info, vp, info.nmi_v3); - info.nmi_procp = uiop->uio_procp; + info.nmi_procp = curproc; info.nmi_cred = cred; error = nfs_request(vp, NFSPROC_READLINK, &info); @@ -1052,7 +1052,7 @@ nfs_readrpc(struct vnode *vp, struct uio *uiop) *tl = 0; } - info.nmi_procp = uiop->uio_procp; + info.nmi_procp = curproc; info.nmi_cred = VTONFS(vp)->n_rcred; error = nfs_request(vp, NFSPROC_READ, &info); if (info.nmi_v3) @@ -1136,7 +1136,7 @@ nfs_writerpc(struct vnode *vp, struct uio *uiop, int *iomode, int *must_commit) } nfsm_uiotombuf(&info.nmi_mb, uiop, len); - info.nmi_procp = uiop->uio_procp; + info.nmi_procp = curproc; info.nmi_cred = VTONFS(vp)->n_wcred; error = nfs_request(vp, NFSPROC_WRITE, &info); if (info.nmi_v3) { @@ -1259,6 +1259,7 @@ nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, txdr_nfsv2time(&vap->va_mtime, &sp->sa_mtime); } + KASSERT(cnp->cn_proc == curproc); info.nmi_procp = cnp->cn_proc; info.nmi_cred = cnp->cn_cred; error = nfs_request(dvp, NFSPROC_MKNOD, &info); @@ -1371,6 +1372,7 @@ again: txdr_nfsv2time(&vap->va_mtime, &sp->sa_mtime); } + KASSERT(cnp->cn_proc == curproc); info.nmi_procp = cnp->cn_proc; info.nmi_cred = cnp->cn_cred; error = nfs_request(dvp, NFSPROC_CREATE, &info); @@ -1616,7 +1618,7 @@ nfs_renameit(struct vnode *sdvp, struct componentname *scnp, struct sillyrename *sp) { return (nfs_renamerpc(sdvp, scnp->cn_nameptr, scnp->cn_namelen, - sdvp, sp->s_name, sp->s_namlen, scnp->cn_cred, scnp->cn_proc)); + sdvp, sp->s_name, sp->s_namlen, scnp->cn_cred, curproc)); } /* @@ -3050,7 +3052,7 @@ nfs_writebp(struct buf *bp, int force) } bp->b_flags |= B_WRITEINPROG; - retv = nfs_commit(bp->b_vp, off, cnt, bp->b_proc); + retv = nfs_commit(bp->b_vp, off, cnt, curproc); bp->b_flags &= ~B_WRITEINPROG; if (retv == 0) { |