Source-Changes-HG archive

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

[src/netbsd-1-6]: src/sys/miscfs/fifofs Pullup rev 1.46 (requested by wrstude...



details:   https://anonhg.NetBSD.org/src/rev/e0eb65a088f8
branches:  netbsd-1-6
changeset: 531152:e0eb65a088f8
user:      jmc <jmc%NetBSD.org@localhost>
date:      Mon Mar 15 05:34:17 2004 +0000

description:
Pullup rev 1.46 (requested by wrstuden in ticket #1621)

Handle the case of fifo_close() getting called from vclean().
Fixes memory leak in revoke(2) path.

diffstat:

 sys/miscfs/fifofs/fifo_vnops.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 3a5f2d96a77f -r e0eb65a088f8 sys/miscfs/fifofs/fifo_vnops.c
--- a/sys/miscfs/fifofs/fifo_vnops.c    Mon Mar 15 05:30:14 2004 +0000
+++ b/sys/miscfs/fifofs/fifo_vnops.c    Mon Mar 15 05:34:17 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fifo_vnops.c,v 1.33.10.1 2002/07/29 14:56:43 lukem Exp $       */
+/*     $NetBSD: fifo_vnops.c,v 1.33.10.2 2004/03/15 05:34:17 jmc Exp $ */
 
 /*
  * Copyright (c) 1990, 1993, 1995
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fifo_vnops.c,v 1.33.10.1 2002/07/29 14:56:43 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fifo_vnops.c,v 1.33.10.2 2004/03/15 05:34:17 jmc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -441,7 +441,12 @@
                if (--fip->fi_writers == 0)
                        socantrcvmore(fip->fi_readsock);
        }
-       if (--fip->fi_opencount == 0) {
+       /*
+        * shut down if either last close, or if close called from
+        * vclean()
+        */
+       if ((--fip->fi_opencount == 0)
+           || ((ap->a_fflag & (FREAD | FWRITE | FNONBLOCK)) == FNONBLOCK)) {
                (void) soclose(fip->fi_readsock);
                (void) soclose(fip->fi_writesock);
                FREE(fip, M_VNODE);



Home | Main Index | Thread Index | Old Index