svn commit: r211684 - head/sys/kern

Brian Somers brian at FreeBSD.org
Wed Aug 25 10:03:40 UTC 2010


On Mon, 23 Aug 2010 13:28:58 +0300 Kostik Belousov <kostikbel at gmail.com> wrote:
> On Mon, Aug 23, 2010 at 05:33:31AM +0000, Brian Somers wrote:
> > 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.
> Isn't this should be fixed in nfs instead ? Please note that the moral
> equivalent of the code is also present in compat/linux/linux_cwd.c:
> linux_getcwd_scandir(). I did not inspected other callers of
> VOP_READDIR.
> 
> >   
> >   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);

I'm looking into why uio_resid isn't being updated - it's a bit awkward
as this is happening on a production box running 8.1 (just upgraded
from 7), so it may take a few days.

-- 
Brian Somers                                          <brian at Awfulhak.org>
Don't _EVER_ lose your sense of humour !               <brian at FreeBSD.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 306 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20100825/e56e04d3/signature.pgp


More information about the svn-src-all mailing list