Author: brian
Date: Mon Aug 23 05:33:31 2010
New Revision: 211684
URL: http://svn.freebsd.org/changeset/base/211684

Log:
  uio_resid isn't updated by VOP_READDIR for nfs filesystems.  Use
  the uio_offset adjustment instead to calculate a correct *len.
  
  Without this change, we run off the end of the directory data
  we're reading and panic horribly for nfs filesystems.
  
  MFC after:    1 week

Modified:
  head/sys/kern/vfs_default.c

Modified: head/sys/kern/vfs_default.c
==============================================================================
--- head/sys/kern/vfs_default.c Mon Aug 23 05:33:20 2010        (r211683)
+++ head/sys/kern/vfs_default.c Mon Aug 23 05:33:31 2010        (r211684)
@@ -281,10 +281,9 @@ get_next_dirent(struct vnode *vp, struct
                if (error)
                        return (error);
 
-               *off = uio.uio_offset;
-
                *cpos = dirbuf;
-               *len = (dirbuflen - uio.uio_resid);
+               *len = uio.uio_offset - *off;
+               *off = uio.uio_offset;
        }
 
        dp = (struct dirent *)(*cpos);
_______________________________________________
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