mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
This commit is contained in:
parent
a866e17077
commit
6792415119
1 changed files with 3 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue