Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys/kern Pull up following revision(s) (requested by mlel...
details: https://anonhg.NetBSD.org/src/rev/5fb07fdf3eb8
branches: netbsd-7
changeset: 450958:5fb07fdf3eb8
user: martin <martin%NetBSD.org@localhost>
date: Wed May 01 09:48:56 2019 +0000
description:
Pull up following revision(s) (requested by mlelstv in ticket #1692):
sys/kern/sys_pipe.c: revision 1.147
sys/kern/sys_pipe.c: revision 1.148
Clean up pipe structure before recycling it.
Handle half-closed pipes in FIONWRITE and FIONSPACE.
diffstat:
sys/kern/sys_pipe.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diffs (55 lines):
diff -r 1a011cb3b142 -r 5fb07fdf3eb8 sys/kern/sys_pipe.c
--- a/sys/kern/sys_pipe.c Wed May 01 09:47:05 2019 +0000
+++ b/sys/kern/sys_pipe.c Wed May 01 09:48:56 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_pipe.c,v 1.138 2014/02/25 18:30:11 pooka Exp $ */
+/* $NetBSD: sys_pipe.c,v 1.138.4.1 2019/05/01 09:48:56 martin Exp $ */
/*-
* Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.138 2014/02/25 18:30:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.138.4.1 2019/05/01 09:48:56 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1107,10 +1107,12 @@
case FIONWRITE:
/* Look at other side */
+ mutex_enter(lock);
pipe = pipe->pipe_peer;
- mutex_enter(lock);
+ if (pipe == NULL)
+ *(int *)data = 0;
#ifndef PIPE_NODIRECT
- if (pipe->pipe_state & PIPE_DIRECTW)
+ else if (pipe->pipe_state & PIPE_DIRECTW)
*(int *)data = pipe->pipe_map.cnt;
else
#endif
@@ -1120,8 +1122,11 @@
case FIONSPACE:
/* Look at other side */
+ mutex_enter(lock);
pipe = pipe->pipe_peer;
- mutex_enter(lock);
+ if (pipe == NULL)
+ *(int *)data = 0;
+ else
#ifndef PIPE_NODIRECT
/*
* If we're in direct-mode, we don't really have a
@@ -1346,6 +1351,8 @@
free_resources:
pipe->pipe_pgid = 0;
pipe->pipe_state = PIPE_SIGNALR;
+ pipe->pipe_peer = NULL;
+ pipe->pipe_lock = NULL;
pipe_free_kmem(pipe);
if (pipe->pipe_kmem != 0) {
pool_cache_put(pipe_rd_cache, pipe);
Home |
Main Index |
Thread Index |
Old Index