Merge fifo_vnops.c:1.133 from HEAD to RELENG_6:

If fifo_open() is called with a negative file descriptor, return EINVAL
  rather than panicking later.  This can occur if the kernel calls
  vn_open() on a fifo, as there will be no associated file descriptor,
  and therefore the file descriptor operations cannot be modified to
  point to the fifo operation set.

  Reported by:    Martin <nakal at nurfuerspam dot de>
  PR:             94278

Approved by:    re (scottl)
This commit is contained in:
rwatson 2006-03-20 14:24:21 +00:00
parent 813c792bf7
commit aa083dc18c

View File

@ -179,6 +179,8 @@ fifo_open(ap)
int error;
ASSERT_VOP_LOCKED(vp, "fifo_open");
if (ap->a_fdidx < 0)
return (EINVAL);
if ((fip = vp->v_fifoinfo) == NULL) {
MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK);
error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, cred, td);