Handle the case of fifo_close() getting called from vclean(). In that
case, we tear down the node-specific storage as if there were no more open users. As vclean() will VT_NON the vnode before anyone else will get access to the vnode, this is our last chance. Fixes memory leak in revoke(2) path noticed by tedu at openbsd dot org.
This commit is contained in:
parent
d56da55ea4
commit
8383006f0f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fifo_vnops.c,v 1.45 2003/11/29 10:02:42 matt Exp $ */
|
||||
/* $NetBSD: fifo_vnops.c,v 1.46 2004/03/06 00:38:29 wrstuden Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993, 1995
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fifo_vnops.c,v 1.45 2003/11/29 10:02:42 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fifo_vnops.c,v 1.46 2004/03/06 00:38:29 wrstuden Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -440,7 +440,12 @@ fifo_close(void *v)
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue