From owner-svn-src-stable@freebsd.org Sat Mar 18 12:39:26 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 48639D10F8B; Sat, 18 Mar 2017 12:39:26 +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 178BB1158; Sat, 18 Mar 2017 12:39:26 +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 v2ICdPp2024750; Sat, 18 Mar 2017 12:39:25 GMT (envelope-from mmokhi@FreeBSD.org) Received: (from mmokhi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2ICdPvU024749; Sat, 18 Mar 2017 12:39:25 GMT (envelope-from mmokhi@FreeBSD.org) Message-Id: <201703181239.v2ICdPvU024749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmokhi set sender to mmokhi@FreeBSD.org using -f From: Mahdi Mokhtari Date: Sat, 18 Mar 2017 12:39:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r315481 - stable/10/sys/kern X-SVN-Group: stable-10 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: Sat, 18 Mar 2017 12:39:26 -0000 Author: mmokhi (ports committer) Date: Sat Mar 18 12:39:24 2017 New Revision: 315481 URL: https://svnweb.freebsd.org/changeset/base/315481 Log: MFC r314996: Fix NULL pointer dereference and panic with shm file pread/pwrite. PR: 217429 Approved by: dchagin Modified: stable/10/sys/kern/sys_generic.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/sys_generic.c ============================================================================== --- stable/10/sys/kern/sys_generic.c Sat Mar 18 11:13:54 2017 (r315480) +++ stable/10/sys/kern/sys_generic.c Sat Mar 18 12:39:24 2017 (r315481) @@ -313,7 +313,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); @@ -524,7 +525,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);