aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2023-09-12 12:39:52 -0700
committerCarlos Maiolino <cem@kernel.org>2023-10-05 14:57:20 +0200
commit7f5bbe286e02b0c7df72aba386b56af92b812dc3 (patch)
treecd913ab97e9870b63f9e8db19026c00d773e3fa7
parent03582d3f3b45e6a6de5dabc30d7ae42baeea3da8 (diff)
downloadxfsprogs-dev-7f5bbe286e02b0c7df72aba386b56af92b812dc3.tar.gz
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 <djwong@kernel.org> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Bill O'Donnell <bodonnel@redhat.com> Signed-off-by: Carlos Maiolino <cem@kernel.org>
-rw-r--r--libxfs/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libxfs/util.c b/libxfs/util.c
index e7d3497ec9..8f79b0cd17 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);