aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Gritton <jamie@FreeBSD.org>2025-09-05 04:48:49 +0000
committerJamie Gritton <jamie@FreeBSD.org>2025-09-05 04:48:49 +0000
commit8ec7a830f10bc0f3b421dfaf6967a1bc996d34fd (patch)
tree5adbab18a94fbbdb091fea6109dfe6f583f9970b
parent8b4e4c2737305df8807abc6cd054a32586085c93 (diff)
jaildesc: fix a misplaced error check and a spurious finit call
Reported by: kib
-rw-r--r--sys/kern/kern_jaildesc.c5
1 files 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);
}