From 7f5bbe286e02b0c7df72aba386b56af92b812dc3 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Tue, 12 Sep 2023 12:39:52 -0700 Subject: [PATCH] libxfs: use XFS_IGET_CREATE when creating new files Use this flag to check that newly allocated inodes are, in fact, unallocated. This matches the kernel, and prevents userspace programs from making latent corruptions worse by unintentionally crosslinking files. Signed-off-by: Darrick J. Wong Reviewed-by: Carlos Maiolino Reviewed-by: Bill O'Donnell Signed-off-by: Carlos Maiolino --- libxfs/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libxfs/util.c b/libxfs/util.c index e7d3497ec..8f79b0cd1 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -260,7 +260,7 @@ libxfs_init_new_inode( unsigned int flags; int error; - error = libxfs_iget(tp->t_mountp, tp, ino, 0, &ip); + error = libxfs_iget(tp->t_mountp, tp, ino, XFS_IGET_CREATE, &ip); if (error != 0) return error; ASSERT(ip != NULL); -- 2.39.5