diff options
author | Christoph Hellwig <hch@lst.de> | 2020-10-16 15:20:39 +0200 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2020-12-01 20:32:55 +0100 |
commit | cbf82e35031b135928f36e72c6d166e935530b6a (patch) | |
tree | 7d893bafdff0aca400ced8dcb6eb930442a05f8c /fs/pstore | |
parent | Linux 5.10-rc2 (diff) | |
download | linux-cbf82e35031b135928f36e72c6d166e935530b6a.tar.xz linux-cbf82e35031b135928f36e72c6d166e935530b6a.zip |
pstore/zone: cap the maximum device size
Introduce an abritrary 128MiB cap to avoid malloc failures when using
a larger block device.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: WeiXiong Liao <gmpy.liaowx@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20201016132047.3068029-2-hch@lst.de
Diffstat (limited to 'fs/pstore')
-rw-r--r-- | fs/pstore/zone.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/pstore/zone.c b/fs/pstore/zone.c index 3ce89216670c..5266ccbec007 100644 --- a/fs/pstore/zone.c +++ b/fs/pstore/zone.c @@ -1299,6 +1299,10 @@ int register_pstore_zone(struct pstore_zone_info *info) pr_warn("total_size must be >= 4096\n"); return -EINVAL; } + if (info->total_size > SZ_128M) { + pr_warn("capping size to 128MiB\n"); + info->total_size = SZ_128M; + } if (!info->kmsg_size && !info->pmsg_size && !info->console_size && !info->ftrace_size) { |