From owner-svn-src-stable@freebsd.org Fri Mar 17 21:03:56 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EC00D1019C; Fri, 17 Mar 2017 21:03:56 +0000 (UTC) (envelope-from mmokhi@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 mx1.freebsd.org (Postfix) with ESMTPS id 02F691A22; Fri, 17 Mar 2017 21:03:55 +0000 (UTC) (envelope-from mmokhi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2HL3tNq032554; Fri, 17 Mar 2017 21:03:55 GMT (envelope-from mmokhi@FreeBSD.org) Received: (from mmokhi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2HL3tvK032553; Fri, 17 Mar 2017 21:03:55 GMT (envelope-from mmokhi@FreeBSD.org) Message-Id: <201703172103.v2HL3tvK032553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmokhi set sender to mmokhi@FreeBSD.org using -f From: Mahdi Mokhtari Date: Fri, 17 Mar 2017 21:03:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r315462 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 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: Fri, 17 Mar 2017 21:03:56 -0000 Author: mmokhi (ports committer) Date: Fri Mar 17 21:03:54 2017 New Revision: 315462 URL: https://svnweb.freebsd.org/changeset/base/315462 Log: MFC r314996 Fix NULL pointer dereference and panic with shm file pread/pwrite. Approved by: dchagin Modified: stable/11/sys/kern/sys_generic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/sys_generic.c ============================================================================== --- stable/11/sys/kern/sys_generic.c Fri Mar 17 18:08:36 2017 (r315461) +++ stable/11/sys/kern/sys_generic.c Fri Mar 17 21:03:54 2017 (r315462) @@ -336,7 +336,8 @@ kern_preadv(td, fd, auio, offset) return (error); if (!(fp->f_ops->fo_flags & DFLAG_SEEKABLE)) error = ESPIPE; - else if (offset < 0 && fp->f_vnode->v_type != VCHR) + else if (offset < 0 && + (fp->f_vnode == NULL || fp->f_vnode->v_type != VCHR)) error = EINVAL; else error = dofileread(td, fd, fp, auio, offset, FOF_OFFSET); @@ -551,7 +552,8 @@ kern_pwritev(td, fd, auio, offset) return (error); if (!(fp->f_ops->fo_flags & DFLAG_SEEKABLE)) error = ESPIPE; - else if (offset < 0 && fp->f_vnode->v_type != VCHR) + else if (offset < 0 && + (fp->f_vnode == NULL || fp->f_vnode->v_type != VCHR)) error = EINVAL; else error = dofilewrite(td, fd, fp, auio, offset, FOF_OFFSET);