Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Mar 2017 21:03:55 +0000 (UTC)
From:      Mahdi Mokhtari <mmokhi@FreeBSD.org>
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
Message-ID:  <201703172103.v2HL3tvK032553@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703172103.v2HL3tvK032553>