smbfs: use curlwp rather than uio->uio_lwp.

the latter is a garbage in the case of UIO_SYSSPACE.
PR/32499 from Juan RP.
This commit is contained in:
yamt 2006-01-12 13:36:17 +00:00
parent 2d28ebdc06
commit 403fb83166
1 changed files with 6 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_io.c,v 1.20 2005/12/11 12:24:29 christos Exp $ */ /* $NetBSD: smbfs_io.c,v 1.21 2006/01/12 13:36:17 yamt Exp $ */
/* /*
* Copyright (c) 2000-2001, Boris Popov * Copyright (c) 2000-2001, Boris Popov
@ -36,7 +36,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smbfs_io.c,v 1.20 2005/12/11 12:24:29 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: smbfs_io.c,v 1.21 2006/01/12 13:36:17 yamt Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -99,7 +99,7 @@ smbfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred)
return EINVAL; return EINVAL;
SMBVDEBUG("dirname='%.*s'\n", (int) np->n_nmlen, np->n_name); SMBVDEBUG("dirname='%.*s'\n", (int) np->n_nmlen, np->n_name);
smb_makescred(&scred, uio->uio_lwp, cred); smb_makescred(&scred, curlwp, cred);
offset = uio->uio_offset / DE_SIZE; /* offset in the directory */ offset = uio->uio_offset / DE_SIZE; /* offset in the directory */
limit = uio->uio_resid / DE_SIZE; limit = uio->uio_resid / DE_SIZE;
@ -191,7 +191,7 @@ smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred)
{ {
struct smbmount *smp = VFSTOSMBFS(vp->v_mount); struct smbmount *smp = VFSTOSMBFS(vp->v_mount);
struct smbnode *np = VTOSMB(vp); struct smbnode *np = VTOSMB(vp);
struct lwp *l; struct lwp *l = curlwp;
struct vattr vattr; struct vattr vattr;
struct smb_cred scred; struct smb_cred scred;
int error; int error;
@ -209,7 +209,6 @@ smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred)
return error; return error;
} }
l = uiop->uio_lwp;
if (np->n_flag & NMODIFIED) { if (np->n_flag & NMODIFIED) {
smbfs_attr_cacheremove(vp); smbfs_attr_cacheremove(vp);
error = VOP_GETATTR(vp, &vattr, cred, l); error = VOP_GETATTR(vp, &vattr, cred, l);
@ -238,8 +237,8 @@ smbfs_writevnode(struct vnode *vp, struct uio *uiop,
struct smbmount *smp = VTOSMBFS(vp); struct smbmount *smp = VTOSMBFS(vp);
struct smbnode *np = VTOSMB(vp); struct smbnode *np = VTOSMB(vp);
struct smb_cred scred; struct smb_cred scred;
struct proc *p; struct lwp *l = curlwp;
struct lwp *l; struct proc *p = l->l_proc;
int error = 0; int error = 0;
int extended = 0; int extended = 0;
size_t resid = uiop->uio_resid; size_t resid = uiop->uio_resid;
@ -254,8 +253,6 @@ smbfs_writevnode(struct vnode *vp, struct uio *uiop,
return EINVAL; return EINVAL;
/* if (uiop->uio_offset + uiop->uio_resid > smp->nm_maxfilesize) /* if (uiop->uio_offset + uiop->uio_resid > smp->nm_maxfilesize)
return (EFBIG);*/ return (EFBIG);*/
l = uiop->uio_lwp;
p = l ? l->l_proc : NULL;
if (ioflag & (IO_APPEND | IO_SYNC)) { if (ioflag & (IO_APPEND | IO_SYNC)) {
if (np->n_flag & NMODIFIED) { if (np->n_flag & NMODIFIED) {
smbfs_attr_cacheremove(vp); smbfs_attr_cacheremove(vp);
@ -315,7 +312,6 @@ smbfs_doio(struct buf *bp, struct ucred *cr, struct lwp *l)
uiop->uio_iov = &io; uiop->uio_iov = &io;
uiop->uio_iovcnt = 1; uiop->uio_iovcnt = 1;
uiop->uio_segflg = UIO_SYSSPACE; uiop->uio_segflg = UIO_SYSSPACE;
uiop->uio_lwp = NULL;
smb_makescred(&scred, l, cr); smb_makescred(&scred, l, cr);