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);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to