Fix panic triggered by code like this:

open("/dev/md0", O_EXEC);

Discussed with:	kib@, mav@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3051
This commit is contained in:
Edward Tomasz Napierala 2015-08-04 10:40:08 +00:00
parent 5884383f19
commit 72800098bf

View File

@ -358,6 +358,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