Add conditional VFS Giant locking to svr4_sys_resolvepath() and mark it

MPSAFE.
This commit is contained in:
jhb 2006-07-19 19:03:03 +00:00
parent 3d1ab82c48
commit 1dccc9f17a
2 changed files with 5 additions and 2 deletions

View File

@ -1600,12 +1600,14 @@ svr4_sys_resolvepath(td, uap)
struct nameidata nd;
int error, *retval = td->td_retval;
unsigned int ncopy;
int vfslocked;
NDINIT(&nd, LOOKUP, NOFOLLOW | SAVENAME, UIO_USERSPACE,
NDINIT(&nd, LOOKUP, NOFOLLOW | SAVENAME | MPSAFE, UIO_USERSPACE,
uap->path, td);
if ((error = namei(&nd)) != 0)
return error;
vfslocked = NDHASGIANT(&nd);
ncopy = min(uap->bufsiz, strlen(nd.ni_cnd.cn_pnbuf) + 1);
if ((error = copyout(nd.ni_cnd.cn_pnbuf, uap->buf, ncopy)) != 0)
@ -1615,5 +1617,6 @@ svr4_sys_resolvepath(td, uap)
bad:
NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_vp);
VFS_UNLOCK_GIANT(vfslocked);
return error;
}

View File

@ -320,7 +320,7 @@
206 AUE_NULL UNIMPL schedctl
207 AUE_NULL UNIMPL pset
208 AUE_NULL UNIMPL whoknows
209 AUE_NULL STD { int svr4_sys_resolvepath(const char *path, \
209 AUE_NULL MSTD { int svr4_sys_resolvepath(const char *path, \
char *buf, size_t bufsiz); }
210 AUE_NULL UNIMPL signotifywait
211 AUE_NULL UNIMPL lwp_sigredirect