Skip to content

Commit 99b3b83

Browse files
Qiujun Huangkees
authored andcommitted
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: 335426c ("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
1 parent 9abf231 commit 99b3b83

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/pstore/zone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ static inline int notrace psz_kmsg_write_record(struct psz_context *cxt,
761761
/* avoid destroying old data, allocate a new one */
762762
len = zone->buffer_size + sizeof(*zone->buffer);
763763
zone->oldbuf = zone->buffer;
764-
zone->buffer = kzalloc(len, GFP_KERNEL);
764+
zone->buffer = kzalloc(len, GFP_ATOMIC);
765765
if (!zone->buffer) {
766766
zone->buffer = zone->oldbuf;
767767
return -ENOMEM;

0 commit comments

Comments
 (0)