Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Sep 2025 23:44:54 GMT
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 4ecbb3f19b44 - stable/15 - MFC jaildesc: fix a misplaced error check and a spurious finit call
Message-ID:  <202509132344.58DNisid054531@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/15 has been updated by jamie:

URL: https://cgit.FreeBSD.org/src/commit/?id=4ecbb3f19b4461b06e408bec4d077774672f3d7b

commit 4ecbb3f19b4461b06e408bec4d077774672f3d7b
Author:     Jamie Gritton <jamie@FreeBSD.org>
AuthorDate: 2025-09-05 04:48:49 +0000
Commit:     Jamie Gritton <jamie@FreeBSD.org>
CommitDate: 2025-09-13 22:37:07 +0000

    MFC jaildesc: fix a misplaced error check and a spurious finit call
    
    Reported by:    kib
    
    (cherry picked from commit 8ec7a830f10bc0f3b421dfaf6967a1bc996d34fd)
---
 sys/kern/kern_jaildesc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/kern/kern_jaildesc.c b/sys/kern/kern_jaildesc.c
index e00ec9a4bfff..fec9b5719b2e 100644
--- a/sys/kern/kern_jaildesc.c
+++ b/sys/kern/kern_jaildesc.c
@@ -133,12 +133,12 @@ jaildesc_alloc(struct thread *td, struct file **fpp, int *fdp, int owning)
 		mode = 0;
 	jd = malloc(sizeof(*jd), M_JAILDESC, M_WAITOK | M_ZERO);
 	error = falloc_caps(td, &fp, fdp, 0, NULL);
-	finit(fp, priv_check_cred(fp->f_cred, PRIV_JAIL_SET) == 0
-	    ? FREAD | FWRITE : FREAD, DTYPE_JAILDESC, jd, &jaildesc_ops);
 	if (error != 0) {
 		free(jd, M_JAILDESC);
 		return (error);
 	}
+	finit(fp, priv_check_cred(fp->f_cred, PRIV_JAIL_SET) == 0
+	    ? FREAD | FWRITE : FREAD, DTYPE_JAILDESC, jd, &jaildesc_ops);
 	JAILDESC_LOCK_INIT(jd);
 	jd->jd_uid = fp->f_cred->cr_uid;
 	jd->jd_gid = fp->f_cred->cr_gid;
@@ -234,7 +234,6 @@ jaildesc_close(struct file *fp, struct thread *td)
 		JAILDESC_LOCK_DESTROY(jd);
 		free(jd, M_JAILDESC);
 	}
-	finit(fp, 0, DTYPE_NONE, NULL, &badfileops);
 	return (0);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202509132344.58DNisid054531>