mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-23 08:35:19 -05:00
pstore/zone: Use GFP_ATOMIC to allocate zone buffer
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>
Fixes: 335426c6dc
("pstore/zone: Provide way to skip "broken" zone for MTD devices")
Cc: WeiXiong Liao <gmpy.liaowx@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/CAJRQjofRCF7wjrYmw3D7zd5QZnwHQq+F8U-mJDJ6NZ4bddYdLA@mail.gmail.com
This commit is contained in:
parent
9abf2313ad
commit
99b3b83785
1 changed files with 1 additions and 1 deletions
|
@ -761,7 +761,7 @@ static inline int notrace psz_kmsg_write_record(struct psz_context *cxt,
|
||||||
/* avoid destroying old data, allocate a new one */
|
/* avoid destroying old data, allocate a new one */
|
||||||
len = zone->buffer_size + sizeof(*zone->buffer);
|
len = zone->buffer_size + sizeof(*zone->buffer);
|
||||||
zone->oldbuf = zone->buffer;
|
zone->oldbuf = zone->buffer;
|
||||||
zone->buffer = kzalloc(len, GFP_KERNEL);
|
zone->buffer = kzalloc(len, GFP_ATOMIC);
|
||||||
if (!zone->buffer) {
|
if (!zone->buffer) {
|
||||||
zone->buffer = zone->oldbuf;
|
zone->buffer = zone->oldbuf;
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
Loading…
Add table
Reference in a new issue