From owner-svn-src-stable@FreeBSD.ORG Thu Oct 8 11:28:33 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 687C8106566B; Thu, 8 Oct 2009 11:28:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55C008FC17; Thu, 8 Oct 2009 11:28:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n98BSXio021502; Thu, 8 Oct 2009 11:28:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n98BSWCd021500; Thu, 8 Oct 2009 11:28:32 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200910081128.n98BSWCd021500@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 8 Oct 2009 11:28:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197855 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 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, 08 Oct 2009 11:28:33 -0000 Author: kib Date: Thu Oct 8 11:28:32 2009 New Revision: 197855 URL: http://svn.freebsd.org/changeset/base/197855 Log: MFC r197662: Do not dereference vp->v_mount without holding vnode lock and checking that the vnode is not reclaimed. Approved by: re (bz) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/uipc_syscalls.c Modified: stable/8/sys/kern/uipc_syscalls.c ============================================================================== --- stable/8/sys/kern/uipc_syscalls.c Thu Oct 8 11:07:15 2009 (r197854) +++ stable/8/sys/kern/uipc_syscalls.c Thu Oct 8 11:28:32 2009 (r197855) @@ -2085,9 +2085,11 @@ retry_space: /* * Get the page from backing store. */ - bsize = vp->v_mount->mnt_stat.f_iosize; vfslocked = VFS_LOCK_GIANT(vp->v_mount); - vn_lock(vp, LK_SHARED | LK_RETRY); + error = vn_lock(vp, LK_SHARED); + if (error != 0) + goto after_read; + bsize = vp->v_mount->mnt_stat.f_iosize; /* * XXXMAC: Because we don't have fp->f_cred @@ -2100,6 +2102,7 @@ retry_space: IO_VMIO | ((MAXBSIZE / bsize) << IO_SEQSHIFT), td->td_ucred, NOCRED, &resid, td); VOP_UNLOCK(vp, 0); + after_read: VFS_UNLOCK_GIANT(vfslocked); VM_OBJECT_LOCK(obj); vm_page_io_finish(pg);