Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Mar 2017 12:39:25 +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-10@freebsd.org
Subject:   svn commit: r315481 - stable/10/sys/kern
Message-ID:  <201703181239.v2ICdPvU024749@repo.freebsd.org>

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



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