jail: Fix locking on an early jail_set error.

I had locked allprison_lock without immediately setting PD_LIST_LOCKED.
This commit is contained in:
Jamie Gritton 2021-02-25 19:52:58 -08:00
parent 1fc928770b
commit 108a9384e9

View File

@ -998,13 +998,13 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags)
jid = 0;
}
sx_xlock(&allprison_lock);
drflags = PD_LIST_XLOCKED;
ppr = mypr;
if (!prison_isalive(ppr)) {
/* This jail is dying. This process will surely follow. */
error = EAGAIN;
goto done_deref;
}
drflags = PD_LIST_XLOCKED;
if (jid != 0) {
if (jid < 0) {
error = EINVAL;