summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorKazuki Hanai <hnkz.64@gmail.com>2026-10-02 17:13:03 +0900
committerAndrew Morton <akpm@linux-foundation.org>2026-10-13 21:25:49 -0700
commitf439d79e8cd19f89e04cbb3b532347edacd72c79 (patch)
tree036c33d59e71aea451e50c41eec9f732e7d7832a /include/linux
parentb682d597aa273cad6e99e665e0fd2a7eb8aa2cef (diff)
tmpfs: fix unicode_map leaks in casefold option handling
shmem_parse_opt_casefold() stores the unicode_map returned by utf8_load() in ctx->encoding. A filesystem context can receive the casefold parameter more than once, and a second successful parse overwrites the stored map without releasing it. The map is also leaked when an unmounted filesystem context is freed. This includes the temporary context used for remount, because shmem_reconfigure() does not take ownership of ctx->encoding. Reject a second casefold setting, clear ctx->encoding after transferring ownership to the superblock, and release any remaining map from shmem_free_fc(). An unprivileged user can repeatedly create tmpfs filesystem contexts, set the casefold parameter, and close them from a user namespace. This causes unbounded kernel memory consumption and can result in a local denial of service. Link: https://lore.kernel.org/20261002081306.637148-1-hnkz.64@gmail.com Fixes: 58e55efd6c72 ("tmpfs: Add casefold lookup support") Signed-off-by: Kazuki Hanai <hnkz.64@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Suggested-by: Gabriel Krisman Bertazi <gabriel@krisman.be> Cc: Hugh Dickins <hughd@google.com> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: André Almeida <andrealmeid@igalia.com> Cc: Christian Brauner <brauner@kernel.org> Cc: <stable@vger.kernel.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions