git: 8ec7a830f10b - main - jaildesc: fix a misplaced error check and a spurious finit call Reported by: kib
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 Sep 2025 04:50:35 UTC
The branch main has been updated by jamie:
URL: https://cgit.FreeBSD.org/src/commit/?id=8ec7a830f10bc0f3b421dfaf6967a1bc996d34fd
commit 8ec7a830f10bc0f3b421dfaf6967a1bc996d34fd
Author: Jamie Gritton <jamie@FreeBSD.org>
AuthorDate: 2025-09-05 04:48:49 +0000
Commit: Jamie Gritton <jamie@FreeBSD.org>
CommitDate: 2025-09-05 04:48:49 +0000
jaildesc: fix a misplaced error check and a spurious finit call
Reported by: kib
---
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);
}