Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern The file being closed is (fdp->fd_lastfile - i), no...
details: https://anonhg.NetBSD.org/src/rev/9fded5737436
branches: trunk
changeset: 581023:9fded5737436
user: wrstuden <wrstuden%NetBSD.org@localhost>
date: Fri May 20 16:13:00 2005 +0000
description:
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 ea0b9bec757e -r 9fded5737436 sys/kern/kern_descrip.c
--- a/sys/kern/kern_descrip.c Fri May 20 15:09:45 2005 +0000
+++ b/sys/kern/kern_descrip.c Fri May 20 16:13:00 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.132 2005/05/20 16:13:00 wrstuden 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.132 2005/05/20 16:13:00 wrstuden 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