Stopgap fix for PR kern/46463: disallow passing of kqueue descriptors

via SCM_RIGHT anxiliary socket messages.
This commit is contained in:
martin 2012-06-02 16:16:16 +00:00
parent 7849de7539
commit 10212e900c

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_usrreq.c,v 1.136 2011/06/26 16:42:43 christos Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.137 2012/06/02 16:16:16 martin Exp $ */
/*-
* Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@ -96,7 +96,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.136 2011/06/26 16:42:43 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.137 2012/06/02 16:16:16 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1382,7 +1382,10 @@ unp_internalize(struct mbuf **controlp)
error = EAGAIN;
goto out;
}
if ((fp = fd_getfile(fd)) == NULL) {
if ((fp = fd_getfile(fd)) == NULL
|| fp->f_type == DTYPE_KQUEUE) {
if (fp)
fd_putfile(fd);
atomic_dec_uint(&unp_rights);
nfds = i;
error = EBADF;