git: 108a9384e9e9 - main - jail: Fix locking on an early jail_set error.

Jamie Gritton jamie at FreeBSD.org
Fri Feb 26 03:54:01 UTC 2021


The branch main has been updated by jamie:

URL: https://cgit.FreeBSD.org/src/commit/?id=108a9384e9e945cccba73c959f7e9cdb023cbcad

commit 108a9384e9e945cccba73c959f7e9cdb023cbcad
Author:     Jamie Gritton <jamie at FreeBSD.org>
AuthorDate: 2021-02-26 03:52:58 +0000
Commit:     Jamie Gritton <jamie at FreeBSD.org>
CommitDate: 2021-02-26 03:52:58 +0000

    jail: Fix locking on an early jail_set error.
    
    I had locked allprison_lock without immediately setting PD_LIST_LOCKED.
---
 sys/kern/kern_jail.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index c58751e6f5fe..c8dcf928dfaa 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -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;


More information about the dev-commits-src-all mailing list