From: Darrick J. Wong Date: Thu, 11 Jun 2026 14:05:21 +0000 (-0700) Subject: xfs_healer: don't allow aliasing of mon_fd in setup_monitor X-Git-Tag: v7.1.0~44 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5b0f430d8e592202bce6dd828800c8d1df587e28;p=xfsprogs-dev.git xfs_healer: don't allow aliasing of mon_fd in setup_monitor As the comment says, mon_fp consumes ownership of mon_fd. Therefore, we should set mon_fd to -1 so that we can't use it further on. Codex complains about this logic bomb. Cc: linux-xfs@vger.kernel.org # v7.0.0 Fixes: b9b03770197d19 ("xfs_healer: create daemon to listen for health events") Signed-off-by: "Darrick J. Wong" Reviewed-by: Andrey Albershteyn --- diff --git a/healer/xfs_healer.c b/healer/xfs_healer.c index 4ea8d86a..ec402a78 100644 --- a/healer/xfs_healer.c +++ b/healer/xfs_healer.c @@ -442,6 +442,7 @@ setup_monitor( perror(ctx->mntpoint); goto out_mon_fd; } + mon_fd = -1; /* Increase the buffer size so that we can reduce kernel calls */ ctx->mon_buf = malloc(BUF_SIZE);