jail: revert the attachment part of b4e87a6329

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.
This commit is contained in:
Jamie Gritton 2020-12-31 19:55:49 -08:00
parent d71965127f
commit b58a46347c

View File

@ -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;
}
}