From owner-svn-src-head@freebsd.org Sat Jan 27 16:34:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9BD5ECA556; Sat, 27 Jan 2018 16:34:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 790C76F3EC; Sat, 27 Jan 2018 16:34:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72C6D5237; Sat, 27 Jan 2018 16:34:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0RGY0di087569; Sat, 27 Jan 2018 16:34:00 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0RGY0gO087567; Sat, 27 Jan 2018 16:34:00 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201801271634.w0RGY0gO087567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 27 Jan 2018 16:34:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328480 - in head/sys: fs/ext2fs ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in head/sys: fs/ext2fs ufs/ufs X-SVN-Commit-Revision: 328480 X-SVN-Commit-Repository: base 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.25 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: Sat, 27 Jan 2018 16:34:01 -0000 Author: pfg Date: Sat Jan 27 16:34:00 2018 New Revision: 328480 URL: https://svnweb.freebsd.org/changeset/base/328480 Log: Revert r328479: {ext2|ufs}_readdir: Set limit on valid ncookies values. We aren't allowed to set resid like this. Pointed out by: kib, imp Modified: head/sys/fs/ext2fs/ext2_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 15:33:52 2018 (r328479) +++ head/sys/fs/ext2fs/ext2_lookup.c Sat Jan 27 16:34:00 2018 (r328480) @@ -145,18 +145,14 @@ ext2_readdir(struct vop_readdir_args *ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - int ncookies; + u_int ncookies; int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; if (uio->uio_offset < 0) return (EINVAL); ip = VTOI(vp); - if (uio->uio_resid < 0) - uio->uio_resid = 0; if (ap->a_ncookies != NULL) { - if (uio->uio_resid > MAXPHYS) - uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0; Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 15:33:52 2018 (r328479) +++ head/sys/ufs/ufs/ufs_vnops.c Sat Jan 27 16:34:00 2018 (r328480) @@ -2170,7 +2170,7 @@ ufs_readdir(ap) off_t offset, startoffset; size_t readcnt, skipcnt; ssize_t startresid; - int ncookies; + u_int ncookies; int error; if (uio->uio_offset < 0) @@ -2178,11 +2178,7 @@ ufs_readdir(ap) ip = VTOI(vp); if (ip->i_effnlink == 0) return (0); - if (uio->uio_resid < 0) - uio->uio_resid = 0; if (ap->a_ncookies != NULL) { - if (uio->uio_resid > MAXPHYS) - uio->uio_resid = MAXPHYS; ncookies = uio->uio_resid; if (uio->uio_offset >= ip->i_size) ncookies = 0;