diff options
author | Jamie Gritton <jamie@FreeBSD.org> | 2021-01-01 03:55:49 +0000 |
---|---|---|
committer | Jamie Gritton <jamie@FreeBSD.org> | 2021-01-01 03:55:49 +0000 |
commit | b58a46347c8dd81137ef164fba1ab6b60c5b94c4 (patch) | |
tree | f0b77057212f816cc8b8779ab6cf817063cf7e9c | |
parent | d71965127fb8cf4032d35719760ef431a654bde8 (diff) |
jail: revert the attachment part of b4e87a632955
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.
-rw-r--r-- | sys/kern/kern_jail.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 1ecb023717bd..55006939a5ff 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -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; } } |