svn commit: r289512 - stable/10/sys/geom

Edward Tomasz Napierala trasz at FreeBSD.org
Sun Oct 18 14:36:06 UTC 2015


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


More information about the svn-src-all mailing list