Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Aug 2010 13:28:58 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Brian Somers <brian@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r211684 - head/sys/kern
Message-ID:  <20100823102858.GD2396@deviant.kiev.zoral.com.ua>
In-Reply-To: <201008230533.o7N5XVxa028293@svn.freebsd.org>
References:  <201008230533.o7N5XVxa028293@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--q5PQdybHXkW1/peZ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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
>=20
> 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.

>  =20
>   Without this change, we run off the end of the directory data
>   we're reading and panic horribly for nfs filesystems.
>  =20
>   MFC after:	1 week
>=20
> Modified:
>   head/sys/kern/vfs_default.c
>=20
> Modified: head/sys/kern/vfs_default.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- 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);
> =20
> -		*off =3D uio.uio_offset;
> -
>  		*cpos =3D dirbuf;
> -		*len =3D (dirbuflen - uio.uio_resid);
> +		*len =3D uio.uio_offset - *off;
> +		*off =3D uio.uio_offset;
>  	}
> =20
>  	dp =3D (struct dirent *)(*cpos);

--q5PQdybHXkW1/peZ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAkxyTWkACgkQC3+MBN1Mb4hVnQCgzC0YD5HQPnEg3NpIuKXIqWVb
0WMAnA7Aps14cDsNFgQzoG0AK2RFtXdI
=CSb4
-----END PGP SIGNATURE-----

--q5PQdybHXkW1/peZ--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100823102858.GD2396>