From owner-svn-src-head@freebsd.org Fri Aug 25 09:51:23 2017 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 55354DD3C73; Fri, 25 Aug 2017 09:51:23 +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 213137EFA7; Fri, 25 Aug 2017 09:51:23 +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 v7P9pM7h095002; Fri, 25 Aug 2017 09:51:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7P9pMjm095001; Fri, 25 Aug 2017 09:51:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201708250951.v7P9pMjm095001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 25 Aug 2017 09:51:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322883 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 322883 X-SVN-Commit-Repository: base 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.23 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: Fri, 25 Aug 2017 09:51:23 -0000 Author: kib Date: Fri Aug 25 09:51:22 2017 New Revision: 322883 URL: https://svnweb.freebsd.org/changeset/base/322883 Log: Protect v_rdev dereference with the vnode interlock instead of the vnode lock. Caller of softdep_count_dependencies() may own a buffer lock, which might conflict with the lock order. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 10 days Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Fri Aug 25 08:24:29 2017 (r322882) +++ head/sys/ufs/ffs/ffs_softdep.c Fri Aug 25 09:51:22 2017 (r322883) @@ -13937,9 +13937,9 @@ softdep_count_dependencies(bp, wantcount) */ retry: if (vp->v_type == VCHR) { - VOP_LOCK(vp, LK_RETRY | LK_EXCLUSIVE); + VI_LOCK(vp); mp = vp->v_type == VCHR ? vp->v_rdev->si_mountpt : NULL; - VOP_UNLOCK(vp, 0); + VI_UNLOCK(vp); if (mp == NULL) goto retry; } else if (vp->v_type == VREG) {