Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jun 2026 12:58:45 +0000
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1491ab351b45 - main - ntsync(9): do not double-free obj when finstall() failed
Message-ID:  <6a2ff705.24d39.46b7366a@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=1491ab351b45b1c727eeed40027f7b5074b19ff5

commit 1491ab351b45b1c727eeed40027f7b5074b19ff5
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-06-15 04:41:53 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-06-15 12:57:41 +0000

    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
---
 sys/dev/ntsync/ntsync.c | 1 +
 1 file changed, 1 insertion(+)

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--;


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a2ff705.24d39.46b7366a>