Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/kqueue]: src/sys/kern filt_pipedetach(): for EVFILT_WRITE, need to detac...
details: https://anonhg.NetBSD.org/src/rev/fda1bbb58f73
branches: kqueue
changeset: 512502:fda1bbb58f73
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Sat Sep 21 19:40:35 2002 +0000
description:
filt_pipedetach(): for EVFILT_WRITE, need to detach the knote from the
peer's pipe_sel.si_note
this fixes kernel panic for EVFILT_WRITE when the write pipe descriptor
is closed before read or kqueue one
diffstat:
sys/kern/sys_pipe.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diffs (39 lines):
diff -r cd1f18258410 -r fda1bbb58f73 sys/kern/sys_pipe.c
--- a/sys/kern/sys_pipe.c Thu Sep 19 07:18:32 2002 +0000
+++ b/sys/kern/sys_pipe.c Sat Sep 21 19:40:35 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_pipe.c,v 1.5.2.8 2002/09/06 08:48:08 jdolecek Exp $ */
+/* $NetBSD: sys_pipe.c,v 1.5.2.9 2002/09/21 19:40:35 jdolecek Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.5.2.8 2002/09/06 08:48:08 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.5.2.9 2002/09/21 19:40:35 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1906,6 +1906,20 @@
{
struct pipe *cpipe = (struct pipe *)kn->kn_fp->f_data;
+ switch(kn->kn_filter) {
+ case EVFILT_WRITE:
+ /* need the peer structure, not our own */
+ cpipe = cpipe->pipe_peer;
+ break;
+ default:
+ /* nothing to do */
+ }
+
+#ifdef DIAGNOSTIC
+ if (kn->kn_hook != cpipe)
+ panic("filt_pipedetach: inconsistent knote");
+#endif
+
PIPE_LOCK(cpipe);
SLIST_REMOVE(&cpipe->pipe_sel.si_note, kn, knote, kn_selnext);
PIPE_UNLOCK(cpipe);
Home |
Main Index |
Thread Index |
Old Index