From owner-svn-src-stable@FreeBSD.ORG Thu Jan 27 09:52:32 2011 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 50E32106564A; Thu, 27 Jan 2011 09:52:32 +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 3F69A8FC13; Thu, 27 Jan 2011 09:52:32 +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 p0R9qWur009170; Thu, 27 Jan 2011 09:52:32 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0R9qWop009165; Thu, 27 Jan 2011 09:52:32 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201101270952.p0R9qWop009165@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 27 Jan 2011 09:52: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: r217933 - stable/8/sys/fs/tmpfs 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, 27 Jan 2011 09:52:32 -0000 Author: kib Date: Thu Jan 27 09:52:31 2011 New Revision: 217933 URL: http://svn.freebsd.org/changeset/base/217933 Log: MFC r217633: In tmpfs_readdir(), normalize handling of the directory entries that either overflow the supplied buffer, or cause uiomove fail. Do not advance cached de when directory entry was not copied out. Do not return EOF when no entries could be copied due to first entry too large for supplied buffer, signal EINVAL instead. Modified: stable/8/sys/fs/tmpfs/tmpfs_subr.c stable/8/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: 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) Modified: stable/8/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 27 09:33:51 2011 (r217932) +++ stable/8/sys/fs/tmpfs/tmpfs_subr.c Thu Jan 27 09:52:31 2011 (r217933) @@ -804,9 +804,10 @@ tmpfs_dir_getdents(struct tmpfs_node *no /* Copy the new dirent structure into the output buffer and * advance pointers. */ error = uiomove(&d, d.d_reclen, uio); - - (*cntp)++; - de = TAILQ_NEXT(de, td_entries); + if (error == 0) { + (*cntp)++; + de = TAILQ_NEXT(de, td_entries); + } } while (error == 0 && uio->uio_resid > 0 && de != NULL); /* Update the offset and cache. */ Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 27 09:33:51 2011 (r217932) +++ stable/8/sys/fs/tmpfs/tmpfs_vnops.c Thu Jan 27 09:52:31 2011 (r217933) @@ -1277,7 +1277,7 @@ outok: MPASS(error >= -1); if (error == -1) - error = 0; + error = (cnt != 0) ? 0 : EINVAL; if (eofflag != NULL) *eofflag =