[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <173652793731.3103853.15317559735833434900.b4-ty@kernel.org>
Date: Fri, 10 Jan 2025 08:52:18 -0800
From: Kees Cook <kees@...nel.org>
To: linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org,
WeiXiong Liao <gmpy.liaowx@...il.com>,
Eugen Hristev <eugen.hristev@...aro.org>
Cc: Kees Cook <kees@...nel.org>,
gpiccoli@...lia.com,
tony.luck@...el.com
Subject: Re: [PATCH v2] pstore/zone: avoid dereferencing zero sized ptr after init zones
On Fri, 10 Jan 2025 14:57:14 +0200, Eugen Hristev wrote:
> In psz_init_zones, if the requested area has a total_size less than
> record_size, kcalloc will be called with c == 0 and will return
> ZERO_SIZE_PTR.
> Further, this will lead to an oops.
>
> With this patch, in this scenario, it will look like this :
> [ 6.865545] pstore_zone: total size : 28672 Bytes
> [ 6.865547] pstore_zone: kmsg size : 65536 Bytes
> [ 6.865549] pstore_zone: pmsg size : 0 Bytes
> [ 6.865551] pstore_zone: console size : 0 Bytes
> [ 6.865553] pstore_zone: ftrace size : 0 Bytes
> [ 6.872095] pstore_zone: zone dmesg total_size too small
> [ 6.878234] pstore_zone: alloc zones failed
>
> [...]
Applied to for-next/pstore, thanks!
[1/1] pstore/zone: avoid dereferencing zero sized ptr after init zones
https://git.kernel.org/kees/c/067cdf020329
Take care,
--
Kees Cook
Powered by blists - more mailing lists