From owner-svn-src-head@freebsd.org Sat Jul 11 16:44:29 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D6199996C1; Sat, 11 Jul 2015 16:44:29 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E7702C59; Sat, 11 Jul 2015 16:44:29 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6BGiTGS084107; Sat, 11 Jul 2015 16:44:29 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6BGiTfq084106; Sat, 11 Jul 2015 16:44:29 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201507111644.t6BGiTfq084106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 11 Jul 2015 16:44:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285394 - head/sys/compat/linprocfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Jul 2015 16:44:29 -0000 Author: mjg Date: Sat Jul 11 16:44:28 2015 New Revision: 285394 URL: https://svnweb.freebsd.org/changeset/base/285394 Log: linprocfs: vref the vnode passed to vn_fullpath Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Sat Jul 11 16:28:55 2015 (r285393) +++ head/sys/compat/linprocfs/linprocfs.c Sat Jul 11 16:44:28 2015 (r285394) @@ -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);