diff options
author | Yuxiao Zhang <yuxiaozhang@google.com> | 2023-06-27 22:25:41 +0200 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2023-08-18 00:18:24 +0200 |
commit | 104fd0b5e948157f8e8ac88a20b46ba8641d4e95 (patch) | |
tree | dd88e938e7515d17ef837a470b750599818143b8 /fs/pstore/inode.c | |
parent | pstore/ram: Check start of empty przs during init (diff) | |
download | linux-104fd0b5e948157f8e8ac88a20b46ba8641d4e95.tar.xz linux-104fd0b5e948157f8e8ac88a20b46ba8641d4e95.zip |
pstore: Support record sizes larger than kmalloc() limit
Currently pstore record buffers are allocated using kmalloc() which has
a maximum size based on page size. If a large "pmsg-size" module
parameter is specified, pmsg will fail to copy the contents since
memdup_user() is limited to kmalloc() allocation sizes.
Since we don't need physically contiguous memory for any of the pstore
record buffers, use kvzalloc() to avoid such limitations in the core of
pstore and in the ram backend, and explicitly read from userspace using
vmemdup_user(). This also means that any other backends that want to
(or do already) support larger record sizes will Just Work now.
Signed-off-by: Yuxiao Zhang <yuxiaozhang@google.com>
Link: https://lore.kernel.org/r/20230627202540.881909-2-yuxiaozhang@google.com
Co-developed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'fs/pstore/inode.c')
-rw-r--r-- | fs/pstore/inode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index ffbadb8b3032..df7fb2ad4599 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c @@ -54,7 +54,7 @@ static void free_pstore_private(struct pstore_private *private) if (!private) return; if (private->record) { - kfree(private->record->buf); + kvfree(private->record->buf); kfree(private->record->priv); kfree(private->record); } |