]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
fuse2fs: check free space when creating a symlink
authorDarrick J. Wong <djwong@kernel.org>
Fri, 12 Sep 2025 22:26:01 +0000 (15:26 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 17 Oct 2025 23:34:22 +0000 (16:34 -0700)
Make sure we have enough space to create the symlink and its remote
block.

Cc: <linux-ext4@vger.kernel.org> # v1.43
Fixes: 81cbf1ef4f5dab ("misc: add fuse2fs, a FUSE server for e2fsprogs")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
misc/fuse2fs.c

index 6864466435abfbfeb29171a603493e23e9b82646..210807ea493f51954229cb3495934c78ca72ee18 100644 (file)
@@ -1825,6 +1825,10 @@ static int op_symlink(const char *src, const char *dest)
        *node_name = 0;
 
        pthread_mutex_lock(&ff->bfl);
+       if (!fs_can_allocate(ff, 1)) {
+               ret = -ENOSPC;
+               goto out2;
+       }
        err = ext2fs_namei(fs, EXT2_ROOT_INO, EXT2_ROOT_INO, temp_path,
                           &parent);
        *node_name = a;