aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-06-15 04:41:53 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-06-15 12:57:41 +0000
commit1491ab351b45b1c727eeed40027f7b5074b19ff5 (patch)
treebe8e880fee8edcd917ff2ea44cd4a5874f4b2bc6
parent281e350942b26b054ba5bc820c6aae4ae0e03a38 (diff)
ntsync(9): do not double-free obj when finstall() failed
Reported by: Alex S <iwtcex@gmail.com> Sponsored by: The FreeBSD Foundation MFC after: 3 days
-rw-r--r--sys/dev/ntsync/ntsync.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/dev/ntsync/ntsync.c b/sys/dev/ntsync/ntsync.c
index 5fba9775be0e..2dec2f68aa80 100644
--- a/sys/dev/ntsync/ntsync.c
+++ b/sys/dev/ntsync/ntsync.c
@@ -297,6 +297,7 @@ ntsync_create_obj(struct ntsync_obj *obj, struct fileops *fops,
finit(fp, FREAD | FWRITE, DTYPE_NTSYNC, obj, fops);
error = finstall(td, fp, &fd, 0, NULL);
if (error != 0) {
+ finit(fp, FREAD | FWRITE, DTYPE_NONE, NULL, &badfileops);
NTSYNC_PRIV_LOCK(priv);
MPASS(priv->objs_cnt > 0);
priv->objs_cnt--;