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:
kib 2013-12-17 17:28:02 +00:00
parent 89e2f99130
commit 6ef68a4208

View File

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