Skip to content

Commit

Permalink
pstore/zone: cap the maximum device size
Browse files Browse the repository at this point in the history
Introduce an abritrary 128MiB cap to avoid malloc failures when using
a larger block device.

Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: WeiXiong Liao <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
Christoph Hellwig authored and kees committed Dec 1, 2020
1 parent 3cea11c commit cbf82e3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/pstore/zone.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit cbf82e3

Please sign in to comment.