From owner-svn-src-head@FreeBSD.ORG Thu Jul 25 19:37:50 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6D4A47AF; Thu, 25 Jul 2013 19:37:50 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 596172BC6; Thu, 25 Jul 2013 19:37:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6PJboul067514; Thu, 25 Jul 2013 19:37:50 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6PJbosT067513; Thu, 25 Jul 2013 19:37:50 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201307251937.r6PJbosT067513@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 25 Jul 2013 19:37:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253657 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jul 2013 19:37:50 -0000 Author: pfg Date: Thu Jul 25 19:37:49 2013 New Revision: 253657 URL: http://svnweb.freebsd.org/changeset/base/253657 Log: ext2fs: Return EINVAL for negative uio_offset as in UFS. While here drop old comment that doesn't really apply. MFC after: 1 month Discussed with: gleb Modified: head/sys/fs/ext2fs/ext2_lookup.c Modified: head/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- head/sys/fs/ext2fs/ext2_lookup.c Thu Jul 25 19:34:24 2013 (r253656) +++ head/sys/fs/ext2fs/ext2_lookup.c Thu Jul 25 19:37:49 2013 (r253657) @@ -146,6 +146,8 @@ ext2_readdir(struct vop_readdir_args *ap int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; + if (uio->uio_offset < 0) + return (EINVAL); ip = VTOI(vp); if (ap->a_ncookies != NULL) { ncookies = uio->uio_resid; @@ -162,14 +164,6 @@ ext2_readdir(struct vop_readdir_args *ap ncookies = 0; cookies = NULL; } - /* - * Avoid complications for partial directory entries by adjusting - * the i/o to end at a block boundary. Don't give up (like ufs - * does) if the initial adjustment gives a negative count, since - * many callers don't supply a large enough buffer. The correct - * size is a little larger than DIRBLKSIZ to allow for expansion - * of directory entries, but some callers just use 512. - */ offset = startoffset = uio->uio_offset; startresid = uio->uio_resid; error = 0;