From owner-svn-src-stable@freebsd.org Thu Dec 21 13:32:50 2017 Return-Path: Delivered-To: svn-src-stable@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 E8960E973A2; Thu, 21 Dec 2017 13:32:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 B3DA666965; Thu, 21 Dec 2017 13:32:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBLDWnqV051200; Thu, 21 Dec 2017 13:32:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBLDWn5U051199; Thu, 21 Dec 2017 13:32:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201712211332.vBLDWn5U051199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 21 Dec 2017 13:32:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r327060 - stable/10/sys/fs/devfs X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/fs/devfs X-SVN-Commit-Revision: 327060 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Dec 2017 13:32:51 -0000 Author: kib Date: Thu Dec 21 13:32:49 2017 New Revision: 327060 URL: https://svnweb.freebsd.org/changeset/base/327060 Log: MFC r326851: In devfs_lookupx() dotdot lookup case, avoid dereferencing dvp->v_mount after dvp is unlocked. Modified: stable/10/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/10/sys/fs/devfs/devfs_vnops.c Thu Dec 21 13:30:56 2017 (r327059) +++ stable/10/sys/fs/devfs/devfs_vnops.c Thu Dec 21 13:32:49 2017 (r327060) @@ -869,6 +869,7 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlo struct devfs_dirent *de, *dd; struct devfs_dirent **dde; struct devfs_mount *dmp; + struct mount *mp; struct cdev *cdev; int error, flags, nameiop, dvplocked; char specname[SPECNAMELEN + 1], *pname; @@ -880,7 +881,8 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlo td = cnp->cn_thread; flags = cnp->cn_flags; nameiop = cnp->cn_nameiop; - dmp = VFSTODEVFS(dvp->v_mount); + mp = dvp->v_mount; + dmp = VFSTODEVFS(mp); dd = dvp->v_data; *vpp = NULLVP; @@ -913,8 +915,8 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlo return (ENOENT); dvplocked = VOP_ISLOCKED(dvp); VOP_UNLOCK(dvp, 0); - error = devfs_allocv(de, dvp->v_mount, - cnp->cn_lkflags & LK_TYPE_MASK, vpp); + error = devfs_allocv(de, mp, cnp->cn_lkflags & LK_TYPE_MASK, + vpp); *dm_unlock = 0; vn_lock(dvp, dvplocked | LK_RETRY); return (error); @@ -999,8 +1001,7 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlo return (0); } } - error = devfs_allocv(de, dvp->v_mount, cnp->cn_lkflags & LK_TYPE_MASK, - vpp); + error = devfs_allocv(de, mp, cnp->cn_lkflags & LK_TYPE_MASK, vpp); *dm_unlock = 0; return (error); }