From: Kees Cook <keescook@chromium.org>
To: Qiujun Huang <hqjagain@gmail.com>
Cc: WeiXiong Liao <gmpy.liaowx@gmail.com>,
anton@enomsg.org, ccross@android.com, tony.luck@intel.com,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pstore/zone: Use GFP_ATOMIC to allocate zone buffer
Date: Tue, 6 Sep 2022 13:18:57 -0700 [thread overview]
Message-ID: <202209061315.08B5962@keescook> (raw)
In-Reply-To: <CAJRQjofRCF7wjrYmw3D7zd5QZnwHQq+F8U-mJDJ6NZ4bddYdLA@mail.gmail.com>
On Sun, Sep 04, 2022 at 11:17:13PM +0800, Qiujun Huang wrote:
> There is a case found when triggering a panic_on_oom, pstore fails to dump
> kmsg. Because psz_kmsg_write_record can't get the new buffer.
>
> Handle this by using GFP_ATOMIC to allocate a buffer at lower watermark.
>
> Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
> ---
> fs/pstore/zone.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/pstore/zone.c b/fs/pstore/zone.c
> index 017d0d4ad329..2770746bb7aa 100644
> --- a/fs/pstore/zone.c
> +++ b/fs/pstore/zone.c
> @@ -761,7 +761,7 @@ static inline int notrace
> psz_kmsg_write_record(struct psz_context *cxt,
> /* avoid destroying old data, allocate a new one */
> len = zone->buffer_size + sizeof(*zone->buffer);
> zone->oldbuf = zone->buffer;
> - zone->buffer = kzalloc(len, GFP_KERNEL);
> + zone->buffer = kzalloc(len, GFP_ATOMIC);
> if (!zone->buffer) {
> zone->buffer = zone->oldbuf;
> return -ENOMEM;
This patch appears to be whitespace damaged, but I've manually applied
it. Thank you!
https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=for-next/pstore&id=27001e611bb642287eddf93227bd72d295a35453
--
Kees Cook
prev parent reply other threads:[~2022-09-06 20:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-04 15:17 [PATCH] pstore/zone: Use GFP_ATOMIC to allocate zone buffer Qiujun Huang
2022-09-06 20:18 ` Kees Cook [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202209061315.08B5962@keescook \
--to=keescook@chromium.org \
--cc=anton@enomsg.org \
--cc=ccross@android.com \
--cc=gmpy.liaowx@gmail.com \
--cc=hqjagain@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox