Do not allow O_EXEC opens for fifo, return EINVAL.

Besides not making sense, open(O_EXEC) for fifo creates fifoinfo with
zero readers and writers counts, which causes premature free of pipes.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2013-12-17 17:28:02 +00:00
parent da0770bd57
commit f26ca5ecde
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=259521

View file

@ -143,7 +143,7 @@ fifo_open(ap)
fp = ap->a_fp;
td = ap->a_td;
ASSERT_VOP_ELOCKED(vp, "fifo_open");
if (fp == NULL)
if (fp == NULL || (ap->a_mode & FEXEC) != 0)
return (EINVAL);
if ((fip = vp->v_fifoinfo) == NULL) {
error = pipe_named_ctor(&fpipe, td);