Lock Giant around vn_open_cred().
Remove innocent unnecessary call to NDFREE(). Reported by: marcel Reviewed and tested by: pjd MFC after: 3 days
This commit is contained in:
parent
7faac77b19
commit
69ea57cacb
@ -69,7 +69,7 @@ kobj_open_file_vnode(const char *file)
|
||||
struct thread *td = curthread;
|
||||
struct filedesc *fd;
|
||||
struct nameidata nd;
|
||||
int error, flags;
|
||||
int error, flags, vfslocked;
|
||||
|
||||
fd = td->td_proc->p_fd;
|
||||
FILEDESC_XLOCK(fd);
|
||||
@ -86,11 +86,13 @@ kobj_open_file_vnode(const char *file)
|
||||
flags = FREAD | O_NOFOLLOW;
|
||||
NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td);
|
||||
error = vn_open_cred(&nd, &flags, 0, 0, curthread->td_ucred, NULL);
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
if (error != 0)
|
||||
return (NULL);
|
||||
vfslocked = NDHASGIANT(&nd);
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
/* We just unlock so we hold a reference. */
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VFS_UNLOCK_GIANT(vfslocked);
|
||||
return (nd.ni_vp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user