summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2015-10-18 14:36:04 +0000
committertrasz <trasz@FreeBSD.org>2015-10-18 14:36:04 +0000
commite93b464d004e23b7e58e159e6fec69e62351e72b (patch)
treeb6f9ca15d8517f90347e5c377fa06a7b59a70355 /sys
parent43f70df8998af40bd659a3123e2ea855d798c4c4 (diff)
downloadFreeBSD-src-e93b464d004e23b7e58e159e6fec69e62351e72b.zip
FreeBSD-src-e93b464d004e23b7e58e159e6fec69e62351e72b.tar.gz
MFC r286283:
Fix panic triggered by code like this: open("/dev/md0", O_EXEC); Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys')
-rw-r--r--sys/geom/geom_dev.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
index bf2ba9e..1123323 100644
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -356,6 +356,13 @@ g_dev_open(struct cdev *dev, int flags, int fmt, struct thread *td)
#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
OpenPOWER on IntegriCloud