CVS commit: [netbsd-3] src/sys

2009-04-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Apr 11 06:18:21 UTC 2009

Modified Files:
src/sys/kern [netbsd-3]: uipc_usrreq.c
src/sys/sys [netbsd-3]: file.h

Log Message:
Apply patch (requested by mlelstv in ticket #2004):
Avoid deep recursion and file descriptor exhaustion.

1. unp_detach: go not call unp_gc directly for descriptors
   that are unixdomain sockets themselves. Instead mark them
   for cleanup during garbage collection.

2. unp_gc: handle detach of descriptors that were marked earlier.

3. prohibit transfer of descriptors within SCM_RIGHTS messages if
   (num_files_in_transit > maxfiles / unp_rights_ratio)


To generate a diff of this commit:
cvs rdiff -u -r1.80.2.3 -r1.80.2.4 src/sys/kern/uipc_usrreq.c
cvs rdiff -u -r1.53 -r1.53.4.1 src/sys/sys/file.h

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.80.2.3 src/sys/kern/uipc_usrreq.c:1.80.2.4
--- src/sys/kern/uipc_usrreq.c:1.80.2.3	Sun Aug 26 20:27:07 2007
+++ src/sys/kern/uipc_usrreq.c	Sat Apr 11 06:18:20 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.80.2.3 2007/08/26 20:27:07 bouyer Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.80.2.4 2009/04/11 06:18:20 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.80.2.3 2007/08/26 20:27:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.80.2.4 2009/04/11 06:18:20 snj Exp $");
 
 #include 
 #include 
@@ -523,6 +523,7 @@
 u_long	unpdg_recvspace = 4*1024;
 
 int	unp_rights;			/* file descriptors in flight */
+int	unp_rights_ratio = 2;		/* limit, fraction of maxfiles */
 
 int
 unp_attach(struct socket *so)
@@ -959,6 +960,7 @@
 	int i, fd, *fdp;
 	int nfds;
 	u_int neededspace;
+	u_int maxmsg;
 
 	/* Sanity check the control message header */
 	if (cm->cmsg_type != SCM_RIGHTS || cm->cmsg_level != SOL_SOCKET ||
@@ -967,6 +969,11 @@
 
 	/* Verify that the file descriptors are valid */
 	nfds = (cm->cmsg_len - CMSG_ALIGN(sizeof(*cm))) / sizeof(int);
+
+	maxmsg = maxfiles / unp_rights_ratio;
+	if (unp_rights + nfds > maxmsg)
+		return (EAGAIN);
+
 	fdp = (int *)CMSG_DATA(cm);
 	for (i = 0; i < nfds; i++) {
 		fd = *fdp++;
@@ -1150,6 +1157,8 @@
 if (fp->f_count == fp->f_msgcount)
 	continue;
 			}
+			if (fp->f_iflags & FIF_DISCARDED)
+continue;
 			fp->f_flag |= FMARK;
 
 			if (fp->f_type != DTYPE_SOCKET ||
@@ -1255,6 +1264,14 @@
 	for (i = nunref, fpp = extra_ref; --i >= 0; ++fpp) {
 		fp = *fpp;
 		simple_lock(&fp->f_slock);
+		if (fp->f_iflags & FIF_DISCARDED) {
+			fp->f_usecount++;
+			fp->f_msgcount--;
+			simple_unlock(&fp->f_slock);
+			unp_rights--;
+			(void) closef(fp, (struct lwp *)0);
+			simple_lock(&fp->f_slock);
+		}
 		FILE_USE(fp);
 		(void) closef(fp, (struct proc *)0);
 	}
@@ -1339,7 +1356,24 @@
 {
 	if (fp == NULL)
 		return;
+
 	simple_lock(&fp->f_slock);
+	/*
+	 * closing unix domain sockets may cause a deep
+	 * recursion, so leave them open and mark them
+	 * for the garbage collector to discard them safely.
+	 */
+	if (fp->f_type == DTYPE_SOCKET && fp->f_count == 1) {
+		struct socket *so;
+
+		so = (struct socket *)fp->f_data;
+		if (so && so->so_proto->pr_domain == &unixdomain &&
+		(so->so_proto->pr_flags&PR_RIGHTS) != 0) {
+			fp->f_iflags |= FIF_DISCARDED;
+			simple_unlock(&fp->f_slock);
+			return;
+		}
+	}
 	fp->f_usecount++;	/* i.e. FILE_USE(fp) sans locking */
 	fp->f_msgcount--;
 	simple_unlock(&fp->f_slock);

Index: src/sys/sys/file.h
diff -u src/sys/sys/file.h:1.53 src/sys/sys/file.h:1.53.4.1
--- src/sys/sys/file.h:1.53	Sat Feb 12 23:14:03 2005
+++ src/sys/sys/file.h	Sat Apr 11 06:18:21 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: file.h,v 1.53 2005/02/12 23:14:03 christos Exp $	*/
+/*	$NetBSD: file.h,v 1.53.4.1 2009/04/11 06:18:21 snj Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -94,9 +94,10 @@
 
 #define	FIF_WANTCLOSE		0x01	/* a close is waiting for usecount */
 #define	FIF_LARVAL		0x02	/* not fully constructed; don't use */
+#define	FIF_DISCARDED		0x04	/* file is discarded, pending close */
 
 #define	FILE_IS_USABLE(fp)	(((fp)->f_iflags &			\
-  (FIF_WANTCLOSE|FIF_LARVAL)) == 0)
+			(FIF_WANTCLOSE|FIF_LARVAL|FIF_DISCARDED)) == 0)
 
 #define	FILE_SET_MATURE(fp)		\
 do {	\



CVS commit: [netbsd-3] src/sys/kern

2009-04-14 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Tue Apr 14 08:50:29 UTC 2009

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

Log Message:
Fix build problem introduced in ticket #2004 (with patch from mlelstv@).


To generate a diff of this commit:
cvs rdiff -u -r1.80.2.4 -r1.80.2.5 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.80.2.4 src/sys/kern/uipc_usrreq.c:1.80.2.5
--- src/sys/kern/uipc_usrreq.c:1.80.2.4	Sat Apr 11 06:18:20 2009
+++ src/sys/kern/uipc_usrreq.c	Tue Apr 14 08:50:29 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.80.2.4 2009/04/11 06:18:20 snj Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.80.2.5 2009/04/14 08:50:29 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.80.2.4 2009/04/11 06:18:20 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.80.2.5 2009/04/14 08:50:29 jdc Exp $");
 
 #include 
 #include 
@@ -1269,7 +1269,7 @@
 			fp->f_msgcount--;
 			simple_unlock(&fp->f_slock);
 			unp_rights--;
-			(void) closef(fp, (struct lwp *)0);
+			(void) closef(fp, (struct proc *)0);
 			simple_lock(&fp->f_slock);
 		}
 		FILE_USE(fp);



CVS commit: [netbsd-3] src/sys/kern

2009-04-14 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Tue Apr 14 09:02:25 UTC 2009

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

Log Message:
Apply patch (requested by mlelstv in ticket #2005):
Fix a problem with a failure path (see PR kern/38391).


To generate a diff of this commit:
cvs rdiff -u -r1.80.2.5 -r1.80.2.6 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.80.2.5 src/sys/kern/uipc_usrreq.c:1.80.2.6
--- src/sys/kern/uipc_usrreq.c:1.80.2.5	Tue Apr 14 08:50:29 2009
+++ src/sys/kern/uipc_usrreq.c	Tue Apr 14 09:02:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.80.2.5 2009/04/14 08:50:29 jdc Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.80.2.6 2009/04/14 09:02:25 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.80.2.5 2009/04/14 08:50:29 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.80.2.6 2009/04/14 09:02:25 jdc Exp $");
 
 #include 
 #include 
@@ -305,30 +305,30 @@
 		 * has the side-effect of preventing a caller from
 		 * forging SCM_CREDS.
 		 */
-		if (control && (error = unp_internalize(control, p))) {
-			goto die;
+		if (control) {
+			if ((error = unp_internalize(control, p)) != 0) {
+m_freem(control);
+m_freem(m);
+break;
+			}
 		}
 		switch (so->so_type) {
 
 		case SOCK_DGRAM: {
 			if (nam) {
-if ((so->so_state & SS_ISCONNECTED) != 0) {
+if ((so->so_state & SS_ISCONNECTED) != 0)
 	error = EISCONN;
-	goto die;
-}
-error = unp_connect(so, nam, p);
-if (error) {
-die:
-	unp_dispose(control);
-	m_freem(control);
-	m_freem(m);
-	break;
-}
+else
+	error = unp_connect(so, nam, p);
 			} else {
-if ((so->so_state & SS_ISCONNECTED) == 0) {
+if ((so->so_state & SS_ISCONNECTED) == 0)
 	error = ENOTCONN;
-	goto die;
-}
+			}
+			if (error) {
+unp_dispose(control);
+m_freem(control);
+m_freem(m);
+break;
 			}
 			error = unp_output(m, control, unp, p);
 			if (nam)



CVS commit: [netbsd-3] src/sys/dev/pci

2009-03-26 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Mar 26 20:27:18 UTC 2009

Modified Files:
src/sys/dev/pci [netbsd-3]: if_wm.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #2002):
sys/dev/pci/if_wm.c: revision 1.166
Fix the multicast hash bug on ICH9's wm.
Now we can catch ff02::9 on ICH9's wm. Fixes PR#37976.


To generate a diff of this commit:
cvs rdiff -u -r1.100.2.12 -r1.100.2.13 src/sys/dev/pci/if_wm.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/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.100.2.12 src/sys/dev/pci/if_wm.c:1.100.2.13
--- src/sys/dev/pci/if_wm.c:1.100.2.12	Sat Dec 13 20:49:50 2008
+++ src/sys/dev/pci/if_wm.c	Thu Mar 26 20:27:18 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.100.2.12 2008/12/13 20:49:50 bouyer Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.100.2.13 2009/03/26 20:27:18 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.100.2.12 2008/12/13 20:49:50 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.100.2.13 2009/03/26 20:27:18 bouyer Exp $");
 
 #include "bpfilter.h"
 #include "rnd.h"
@@ -3701,7 +3701,7 @@
 	static const int ich8_hi_shift[4] = { 2, 3, 4, 6 };
 	uint32_t hash;
 
-	if (sc->sc_type == WM_T_ICH8) {
+	if ((sc->sc_type == WM_T_ICH8) || (sc->sc_type == WM_T_ICH9)) {
 		hash = (enaddr[4] >> ich8_lo_shift[sc->sc_mchash_type]) |
 		(((uint16_t) enaddr[5]) << ich8_hi_shift[sc->sc_mchash_type]);
 		return (hash & 0x3ff);
@@ -3746,7 +3746,7 @@
 	 * Set the station address in the first RAL slot, and
 	 * clear the remaining slots.
 	 */
-	if (sc->sc_type == WM_T_ICH8)
+	if ((sc->sc_type == WM_T_ICH8) || (sc->sc_type == WM_T_ICH9))
 		size = WM_ICH8_RAL_TABSIZE;
 	else
 		size = WM_RAL_TABSIZE;



CVS commit: [netbsd-3] src/sys/arch/arm/arm

2009-03-26 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Mar 26 20:18:55 UTC 2009

Modified Files:
src/sys/arch/arm/arm [netbsd-3]: bcopyinout_xscale.S

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1993):
sys/arch/arm/arm/bcopyinout_xscale.S: revision 1.4
Must have a nop after an add to the pc.
This corrects a bug affecting kcopy() to unaligned dst addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.16.1 src/sys/arch/arm/arm/bcopyinout_xscale.S

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

Modified files:

Index: src/sys/arch/arm/arm/bcopyinout_xscale.S
diff -u src/sys/arch/arm/arm/bcopyinout_xscale.S:1.3 src/sys/arch/arm/arm/bcopyinout_xscale.S:1.3.16.1
--- src/sys/arch/arm/arm/bcopyinout_xscale.S:1.3	Mon Dec 15 09:27:18 2003
+++ src/sys/arch/arm/arm/bcopyinout_xscale.S	Thu Mar 26 20:18:55 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcopyinout_xscale.S,v 1.3 2003/12/15 09:27:18 scw Exp $	*/
+/*	$NetBSD: bcopyinout_xscale.S,v 1.3.16.1 2009/03/26 20:18:55 bouyer Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -35,7 +35,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-RCSID("$NetBSD: bcopyinout_xscale.S,v 1.3 2003/12/15 09:27:18 scw Exp $")	
+RCSID("$NetBSD: bcopyinout_xscale.S,v 1.3.16.1 2009/03/26 20:18:55 bouyer Exp $")	
 
 	.text
 	.align	0
@@ -982,6 +982,7 @@
 	sub	r2, r2, ip
 	rsbs	ip, ip, #0x03
 	addne	pc, pc, ip, lsl #3
+	nop
 	ldrb	ip, [r0], #0x01
 	strb	ip, [r1], #0x01
 	ldrb	ip, [r0], #0x01



CVS commit: [netbsd-3] src/sys/arch/vax/vax

2009-04-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 23 02:11:53 UTC 2009

Modified Files:
src/sys/arch/vax/vax [netbsd-3]: subr.S

Log Message:
Pull up following revision(s) (requested by mhitch in ticket #2010):
sys/arch/vax/vax/subr.S: revision 1.26
Apply patch from mhitch@:
Make copyin(9) and copyout(9) work with 64KB or larger data blocks.
Fixes broken pipe(2) problem mentioned in PR port-vax/41139. Ok'ed by ra...@.
Should be pulled up to netbsd-5.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.14.1 src/sys/arch/vax/vax/subr.S

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

Modified files:

Index: src/sys/arch/vax/vax/subr.S
diff -u src/sys/arch/vax/vax/subr.S:1.10 src/sys/arch/vax/vax/subr.S:1.10.14.1
--- src/sys/arch/vax/vax/subr.S:1.10	Sun Jan  4 11:33:31 2004
+++ src/sys/arch/vax/vax/subr.S	Thu Apr 23 02:11:53 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr.S,v 1.10 2004/01/04 11:33:31 jdolecek Exp $	   */
+/*	$NetBSD: subr.S,v 1.10.14.1 2009/04/23 02:11:53 snj Exp $	   */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -479,7 +479,7 @@
 #
 
 ENTRY(copyout, 0)
-	movl	8(%ap),%r2
+	movl	8(%ap),%r3
 	blss	3f		# kernel space
 	movl	4(%ap),%r1
 	brb	2f
@@ -487,13 +487,18 @@
 ENTRY(copyin, 0)
 	movl	4(%ap),%r1
 	blss	3f		# kernel space
-	movl	8(%ap),%r2
-2:	mfpr	$PR_ESP,%r3
-	movab	1f,(%r3)
-	movc3	12(%ap),(%r1),(%r2)
-1:	mfpr	$PR_ESP,%r3
-	clrl	(%r3)
+	movl	8(%ap),%r3
+2:	mfpr	$PR_ESP,%r2
+	movab	1f,(%r2)
+4:	tstw	14(%ap)		# check if >= 64K
+	bneq	5f
+	movc3	12(%ap),(%r1),(%r3)
+1:	mfpr	$PR_ESP,%r2
+	clrl	(%r2)
 	ret
+5:	movc3	$0xfffc,(%r1),(%r3)
+	subl2	$0xfffc,12(%ap)
+	brb	4b
 
 3:	mnegl	$1,%r0
 	ret



CVS commit: [netbsd-3] src/sys/arch/i386/i386

2009-04-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 30 20:28:21 UTC 2009

Modified Files:
src/sys/arch/i386/i386 [netbsd-3]: pmap.c

Log Message:
Apply patch (requested by bouyer in ticket #2012):
Fix an i386 pmap race.


To generate a diff of this commit:
cvs rdiff -u -r1.181.2.2 -r1.181.2.3 src/sys/arch/i386/i386/pmap.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/arch/i386/i386/pmap.c
diff -u src/sys/arch/i386/i386/pmap.c:1.181.2.2 src/sys/arch/i386/i386/pmap.c:1.181.2.3
--- src/sys/arch/i386/i386/pmap.c:1.181.2.2	Mon Sep 26 20:24:52 2005
+++ src/sys/arch/i386/i386/pmap.c	Thu Apr 30 20:28:21 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.181.2.2 2005/09/26 20:24:52 tron Exp $	*/
+/*	$NetBSD: pmap.c,v 1.181.2.3 2009/04/30 20:28:21 snj Exp $	*/
 
 /*
  *
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.181.2.2 2005/09/26 20:24:52 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.181.2.3 2009/04/30 20:28:21 snj Exp $");
 
 #include "opt_cputype.h"
 #include "opt_user_ldt.h"
@@ -2423,6 +2423,9 @@
 
 		/* atomically save the old PTE and zap! it */
 		opte = x86_atomic_testset_ul(pte, 0);
+		if (!pmap_valid_entry(opte))
+			continue;
+
 		pmap_exec_account(pmap, startva, opte, 0);
 
 		if (opte & PG_W)
@@ -2512,6 +2515,9 @@
 
 	/* atomically save the old PTE and zap! it */
 	opte = x86_atomic_testset_ul(pte, 0);
+	if (!pmap_valid_entry(opte))
+		return(FALSE);
+
 	pmap_exec_account(pmap, va, opte, 0);
 
 	if (opte & PG_W)



CVS commit: [netbsd-3] src/sys/arch/amd64/amd64

2009-04-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 30 20:29:56 UTC 2009

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-3]: pmap.c

Log Message:
Apply patch (requested by bouyer in ticket #2012):
Fix a pmap race.


To generate a diff of this commit:
cvs rdiff -u -r1.15.8.2 -r1.15.8.3 src/sys/arch/amd64/amd64/pmap.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/arch/amd64/amd64/pmap.c
diff -u src/sys/arch/amd64/amd64/pmap.c:1.15.8.2 src/sys/arch/amd64/amd64/pmap.c:1.15.8.3
--- src/sys/arch/amd64/amd64/pmap.c:1.15.8.2	Tue Feb 14 13:29:38 2006
+++ src/sys/arch/amd64/amd64/pmap.c	Thu Apr 30 20:29:56 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.15.8.2 2006/02/14 13:29:38 tron Exp $	*/
+/*	$NetBSD: pmap.c,v 1.15.8.3 2009/04/30 20:29:56 snj Exp $	*/
 
 /*
  *
@@ -108,7 +108,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.15.8.2 2006/02/14 13:29:38 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.15.8.3 2009/04/30 20:29:56 snj Exp $");
 
 #ifndef __x86_64__
 #include "opt_cputype.h"
@@ -2480,6 +2480,8 @@
 
 		/* atomically save the old PTE and zap! it */
 		opte = pmap_pte_set(pte, 0);
+		if (!pmap_valid_entry(opte))
+			continue;
 
 		if (opte & PG_W)
 			pmap->pm_stats.wired_count--;
@@ -2562,6 +2564,8 @@
 
 	/* atomically save the old PTE and zap! it */
 	opte = pmap_pte_set(pte, 0);
+	if (!pmap_valid_entry(opte))
+		return(FALSE);
 
 	if (opte & PG_W)
 		pmap->pm_stats.wired_count--;



CVS commit: [netbsd-3] src/sys/arch/xen/xen

2009-05-13 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed May 13 19:39:09 UTC 2009

Modified Files:
src/sys/arch/xen/xen [netbsd-3]: if_xennet_xenbus.c

Log Message:
Pull up following revision(s) (requested by jym in ticket #2013):
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.35
Do not forget to detach rnd(4) device when removing a xennet device.
Ok by bouyer@ in private mail.


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.6 -r1.7.2.7 src/sys/arch/xen/xen/if_xennet_xenbus.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/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.7.2.6 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.7.2.7
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.7.2.6	Fri Mar 20 14:55:32 2009
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Wed May 13 19:39:08 2009
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.7.2.6 2009/03/20 14:55:32 msaitoh Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.7.2.7 2009/05/13 19:39:08 bouyer Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.7.2.6 2009/03/20 14:55:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.7.2.7 2009/05/13 19:39:08 bouyer Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -373,6 +373,12 @@
 		
 	ether_ifdetach(ifp);
 	if_detach(ifp);
+
+#if NRND > 0
+	/* Unhook the entropy source. */
+	rnd_detach_source(&sc->sc_rnd_source);
+#endif
+
 	while (xengnt_status(sc->sc_tx_ring_gntref)) {
 		tsleep(xennet_xenbus_detach, PRIBIO, "xnet_txref", hz/2);
 	}