]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_healer: don't allow aliasing of mon_fd in setup_monitor
authorDarrick J. Wong <djwong@kernel.org>
Thu, 11 Jun 2026 14:05:21 +0000 (07:05 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Wed, 17 Jun 2026 10:49:27 +0000 (12:49 +0200)
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" <djwong@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
healer/xfs_healer.c

index 4ea8d86ac9114a7f71c35f1a921da6f9ae87f2c1..ec402a78d5d2bfb956981dfcb42a5d93af352bc7 100644 (file)
@@ -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);