Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3]: src/sys/kern Pull up revision 1.132 (requested by wrstuden in...



details:   https://anonhg.NetBSD.org/src/rev/7a2eaefee4f9
branches:  netbsd-3
changeset: 575896:7a2eaefee4f9
user:      tron <tron%NetBSD.org@localhost>
date:      Sat May 28 12:41:08 2005 +0000

description:
Pull up revision 1.132 (requested by wrstuden in ticket #331):
The file being closed is (fdp->fd_lastfile - i), not i. So compare
(fdp->fd_lastfile - i) against fd_knlistsize. Otherwise we can
call knote_fdclose() on a file descriptor that doesn't have a knote.
This issue explains random panics I have had on process exit over the
past few years.

diffstat:

 sys/kern/kern_descrip.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r bca50c025430 -r 7a2eaefee4f9 sys/kern/kern_descrip.c
--- a/sys/kern/kern_descrip.c   Sat May 28 12:39:14 2005 +0000
+++ b/sys/kern/kern_descrip.c   Sat May 28 12:41:08 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_descrip.c,v 1.131 2005/02/26 21:34:55 perry Exp $ */
+/*     $NetBSD: kern_descrip.c,v 1.131.2.1 2005/05/28 12:41:08 tron Exp $      */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.131 2005/02/26 21:34:55 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.131.2.1 2005/05/28 12:41:08 tron Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1285,7 +1285,7 @@
                        *fpp = NULL;
                        simple_lock(&fp->f_slock);
                        FILE_USE(fp);
-                       if (i < fdp->fd_knlistsize)
+                       if ((fdp->fd_lastfile - i) < fdp->fd_knlistsize)
                                knote_fdclose(p, fdp->fd_lastfile - i);
                        (void) closef(fp, p);
                }



Home | Main Index | Thread Index | Old Index