summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/compat/linprocfs/linprocfs.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index 9142c93..8aac3ea 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -858,10 +858,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);
@@ -874,12 +884,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);
OpenPOWER on IntegriCloud