diff options
| author | Kazuki Hanai <hnkz.64@gmail.com> | 2026-10-02 17:13:03 +0900 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-10-11 15:18:56 -0700 |
| commit | be9f9add2032f1370fec166e4e91ade5b5cc1042 (patch) | |
| tree | 3517b74d16fcaeec45548f750f627857f83d9d8c /scripts/checkstack.pl | |
| parent | da0407b7b0ea89cc1a2f71d139946b8efb47af23 (diff) | |
| download | linux-next-be9f9add2032f1370fec166e4e91ade5b5cc1042.tar.gz linux-next-be9f9add2032f1370fec166e4e91ade5b5cc1042.zip | |
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 'scripts/checkstack.pl')
0 files changed, 0 insertions, 0 deletions
