Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Oct 2015 14:36:05 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@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: r289512 - stable/10/sys/geom
Message-ID:  <201510181436.t9IEa5Lf093517@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sun Oct 18 14:36:04 2015
New Revision: 289512
URL: https://svnweb.freebsd.org/changeset/base/289512

Log:
  MFC r286283:
  
  Fix panic triggered by code like this:
  open("/dev/md0", O_EXEC);
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/10/sys/geom/geom_dev.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/geom/geom_dev.c
==============================================================================
--- stable/10/sys/geom/geom_dev.c	Sun Oct 18 14:34:13 2015	(r289511)
+++ stable/10/sys/geom/geom_dev.c	Sun Oct 18 14:36:04 2015	(r289512)
@@ -356,6 +356,13 @@ g_dev_open(struct cdev *dev, int flags, 
 #else
 	e = 0;
 #endif
+
+	/*
+	 * This happens on attempt to open a device node with O_EXEC.
+	 */
+	if (r + w + e == 0)
+		return (EINVAL);
+
 	if (w) {
 		/*
 		 * When running in very secure mode, do not allow



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