Skip to content

Commit

Permalink
jail: revert the attachment part of b4e87a6
Browse files Browse the repository at this point in the history
The change to kern_jail_set that was supposed to "also properly clean
up when attachment fails" didn't fix a memory leak but actually caused
a double free.  Back that part out, and leave the part that manages
allprison_lock state.
  • Loading branch information
Jamie Gritton authored and Jamie Gritton committed Jan 1, 2021
1 parent d719651 commit b58a463
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions sys/kern/kern_jail.c
Original file line number Diff line number Diff line change
Expand Up @@ -1835,14 +1835,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags)
slocked = 0;
if (error) {
vfs_opterror(opts, "attach failed");
if (born) {
sx_slock(&allprison_lock);
slocked = PD_LIST_SLOCKED;
(void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL);
}
prison_deref(pr, created
? slocked
: PD_DEREF | slocked);
if (!created)
prison_deref(pr, PD_DEREF);
goto done_errmsg;
}
}
Expand Down

0 comments on commit b58a463

Please sign in to comment.