diff options
author | silby <silby@FreeBSD.org> | 2005-01-17 07:56:28 +0000 |
---|---|---|
committer | silby <silby@FreeBSD.org> | 2005-01-17 07:56:28 +0000 |
commit | ce62b5450ee0ff724bac229c5eda1bed4d2b2aff (patch) | |
tree | 17f0703535ba0288eb80daebff19b80829c7b69c /sys | |
parent | 6cc4b6c220d4e49fad2881c7dc754fa560248ef8 (diff) | |
download | FreeBSD-src-ce62b5450ee0ff724bac229c5eda1bed4d2b2aff.zip FreeBSD-src-ce62b5450ee0ff724bac229c5eda1bed4d2b2aff.tar.gz |
Rearrange the kninit calls for both directions of a pipe so that
they both happen before pipe backing allocation occurs. Previously,
a pipe memory shortage would cause a panic due to a KNOTE call
on an uninitialized si_note.
Reported by: Peter Holm
MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/sys_pipe.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 7833f20..267670c 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -351,6 +351,9 @@ pipe(td, uap) rpipe = &pp->pp_rpipe; wpipe = &pp->pp_wpipe; + knlist_init(&rpipe->pipe_sel.si_note, PIPE_MTX(rpipe)); + knlist_init(&wpipe->pipe_sel.si_note, PIPE_MTX(wpipe)); + /* Only the forward direction pipe is backed by default */ if (pipe_create(rpipe, 1) || pipe_create(wpipe, 0)) { pipeclose(rpipe); @@ -565,7 +568,6 @@ pipe_create(pipe, backing) /* If we're not backing this pipe, no need to do anything. */ error = 0; } - knlist_init(&pipe->pipe_sel.si_note, PIPE_MTX(pipe)); return (error); } |