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
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to