Message ID | 20201016132047.3068029-2-hch@lst.de |
---|---|
State | Not Applicable |
Headers | show |
Series | [1/9] pstore/zone: cap the maximum device size | expand |
On Fri, Oct 16, 2020 at 9:27 PM Christoph Hellwig <hch@lst.de> wrote: > > Introduce an abritrary 128MiB cap to avoid malloc failures when using > a larger block device. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > fs/pstore/zone.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/pstore/zone.c b/fs/pstore/zone.c > index 3ce89216670c9b..5266ccbec007f3 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; > + } > Reviewed-by: WeiXiong Liao <gmpy.liaowx@gmail.com> > if (!info->kmsg_size && !info->pmsg_size && !info->console_size && > !info->ftrace_size) { > -- > 2.28.0 >
On Fri, Oct 16, 2020 at 03:20:39PM +0200, Christoph Hellwig wrote: > Introduce an abritrary 128MiB cap to avoid malloc failures when using > a larger block device. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Yeah, this seems reasonable. I'm always worried about arbitrary size limits, but if 128M is needed for pstore, something is likely very very wrong. :) Reviewed-by: Kees Cook <keescook@chromium.org>
On Fri, 16 Oct 2020 15:20:39 +0200, Christoph Hellwig wrote: > Introduce an abritrary 128MiB cap to avoid malloc failures when using > a larger block device. I've applied 1-3 of the series to for-next/pstore, thanks! [1/9] pstore/zone: cap the maximum device size https://git.kernel.org/kees/c/cbf82e35031b [2/9] pstore/blk: update the command line example https://git.kernel.org/kees/c/45a8af4412b1 [3/9] pstore/blk: remove {un,}register_pstore_blk https://git.kernel.org/kees/c/b6f8ed33ab2b (I tweaked #3 with a small added comment.)
diff --git a/fs/pstore/zone.c b/fs/pstore/zone.c index 3ce89216670c9b..5266ccbec007f3 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) {
Introduce an abritrary 128MiB cap to avoid malloc failures when using a larger block device. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/pstore/zone.c | 4 ++++ 1 file changed, 4 insertions(+)