Module Name:    src
Committed By:   jdc
Date:           Sun Jun  3 08:47:36 UTC 2012

Modified Files:
        src/sys/kern [netbsd-5-1]: uipc_usrreq.c

Log Message:
Pull up revision 1.137 (requested by martin in ticket #1766).

Stopgap fix for PR kern/46463: disallow passing of kqueue descriptors
via SCM_RIGHT anxiliary socket messages.


To generate a diff of this commit:
cvs rdiff -u -r1.119.4.3 -r1.119.4.3.2.1 src/sys/kern/uipc_usrreq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.119.4.3 src/sys/kern/uipc_usrreq.c:1.119.4.3.2.1
--- src/sys/kern/uipc_usrreq.c:1.119.4.3	Sun Nov  8 21:47:45 2009
+++ src/sys/kern/uipc_usrreq.c	Sun Jun  3 08:47:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.119.4.3 2009/11/08 21:47:45 snj Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.119.4.3.2.1 2012/06/03 08:47:35 jdc 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.119.4.3 2009/11/08 21:47:45 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.119.4.3.2.1 2012/06/03 08:47:35 jdc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1326,7 +1326,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;

Reply via email to