]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: report correct st_size for encrypted symlinks
authorEric Biggers <ebiggers@google.com>
Wed, 1 Sep 2021 16:40:39 +0000 (09:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Sep 2021 06:56:38 +0000 (08:56 +0200)
commite35bbdf7deefc06877c174d8b862074eca7200a7
tree00519678bd56325ee54acd477f627749e77af152
parentfb547e54d274e628693a4fad1ba77a3a7a8ef213
ext4: report correct st_size for encrypted symlinks

commit 8c4bca10ceafc43b1ca0a9fab5fa27e13cbce99e upstream.

The stat() family of syscalls report the wrong size for encrypted
symlinks, which has caused breakage in several userspace programs.

Fix this by calling fscrypt_symlink_getattr() after ext4_getattr() for
encrypted symlinks.  This function computes the correct size by reading
and decrypting the symlink target (if it's not already cached).

For more details, see the commit which added fscrypt_symlink_getattr().

Fixes: 088c6df5d55c ("ext4 crypto: add symlink encryption")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210702065350.209646-3-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/symlink.c