]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
libext2fs: make sure the system.data xattr gets created
authorEric Biggers <ebiggers@google.com>
Sat, 3 Mar 2018 00:59:15 +0000 (16:59 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 3 Mar 2018 20:26:36 +0000 (15:26 -0500)
commit198a2d0a77d1c33790855c7827da6f1520db103e
tree8784d40f72309be6c119fbb25c4e307dd4849755
parentc88970f2258459e84f3fbed3b80653b3e8746dfb
libext2fs: make sure the system.data xattr gets created

Both the kernel and e2fsck expect that if an inode has inline data, then
it contains a "system.data" xattr -- even if i_size <= 60 so the data
fits entirely in i_block.

But if a symlink of exactly 60 bytes (not counting a NUL terminator) was
created using ext2fs_symlink() and the inline data feature was enabled,
then the symlink inode ended up with inline data but without a
system.data xattr.  This is possible because "fast" symlinks store a NUL
terminator but inline data symlinks do not.  So 60 bytes is too long for
a real fast symlink, but still short enough to fit the entire target in
i_block as a "slow" symlink using inline data.

Some places use ext2fs_inline_data_init() to ensure the system.data
xattr is created, but the symlink path does not.

Fix this by making ext2fs_inline_data_set() set system.data to an empty
string when i_size <= 60.

Fixes: 54e880b870f7 ("libext2fs: handle inline data in read/write function")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/inline_data.c
tests/f_create_symlinks/expect
tests/f_create_symlinks/script