linprocfs: vref the vnode passed to vn_fullpath
This commit is contained in:
parent
c634b75204
commit
b34be824a0
@ -873,10 +873,20 @@ linprocfs_doprocstatus(PFS_FILL_ARGS)
|
||||
static int
|
||||
linprocfs_doproccwd(PFS_FILL_ARGS)
|
||||
{
|
||||
struct filedesc *fdp;
|
||||
struct vnode *vp;
|
||||
char *fullpath = "unknown";
|
||||
char *freepath = NULL;
|
||||
|
||||
vn_fullpath(td, p->p_fd->fd_cdir, &fullpath, &freepath);
|
||||
fdp = p->p_fd;
|
||||
FILEDESC_SLOCK(fdp);
|
||||
vp = fdp->fd_cdir;
|
||||
if (vp != NULL)
|
||||
VREF(vp);
|
||||
FILEDESC_SUNLOCK(fdp);
|
||||
vn_fullpath(td, vp, &fullpath, &freepath);
|
||||
if (vp != NULL)
|
||||
vrele(vp);
|
||||
sbuf_printf(sb, "%s", fullpath);
|
||||
if (freepath)
|
||||
free(freepath, M_TEMP);
|
||||
@ -889,12 +899,20 @@ linprocfs_doproccwd(PFS_FILL_ARGS)
|
||||
static int
|
||||
linprocfs_doprocroot(PFS_FILL_ARGS)
|
||||
{
|
||||
struct vnode *rvp;
|
||||
struct filedesc *fdp;
|
||||
struct vnode *vp;
|
||||
char *fullpath = "unknown";
|
||||
char *freepath = NULL;
|
||||
|
||||
rvp = jailed(p->p_ucred) ? p->p_fd->fd_jdir : p->p_fd->fd_rdir;
|
||||
vn_fullpath(td, rvp, &fullpath, &freepath);
|
||||
fdp = p->p_fd;
|
||||
FILEDESC_SLOCK(fdp);
|
||||
vp = jailed(p->p_ucred) ? fdp->fd_jdir : fdp->fd_rdir;
|
||||
if (vp != NULL)
|
||||
VREF(vp);
|
||||
FILEDESC_SUNLOCK(fdp);
|
||||
vn_fullpath(td, vp, &fullpath, &freepath);
|
||||
if (vp != NULL)
|
||||
vrele(vp);
|
||||
sbuf_printf(sb, "%s", fullpath);
|
||||
if (freepath)
|
||||
free(freepath, M_TEMP);
|
||||
|
Loading…
Reference in New Issue
Block a user