Whamcloud - gitweb
libext2fs: fix ext2fs_link() when the directory has an extent tree depth > 1
authorTheodore Ts'o <tytso@mit.edu>
Fri, 6 Jun 2025 22:52:13 +0000 (18:52 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 6 Jun 2025 22:52:13 +0000 (18:52 -0400)
Ext2fs_link() was passing the wrong inode number to ext2fs_bmap(); as
a result, when a directory inode was using extents and the extent tree
depth was greater than 1, the extent tree checksum would be
incorrectly calculated resulting in a error that the extent tree block
checksum was incorrect.

Fixes: 53aa6c54224f ("libext2fs: add the EXT2FS_LINK_APPEND flag ...)
Addresses-Debian-Bug: #1106854
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/link.c

index a617d0a..1697da3 100644 (file)
@@ -641,7 +641,7 @@ retry:
                struct dir_context ctx;
 
                lblk = (inode.i_size / fs->blocksize) - 1;
-               retval = ext2fs_bmap2(fs, ino, &inode, NULL, 0, lblk,
+               retval = ext2fs_bmap2(fs, dir, &inode, NULL, 0, lblk,
                                      NULL, &pblk);
                if (retval)
                        return retval;