summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQiujun Huang <hqjagain@gmail.com>2022-09-04 23:17:13 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-04 11:28:59 +0100
commit23ac2a31c54f5bb39d6e11c47680e588b3a0ca81 (patch)
tree1a57ac0cb14711bdab4615b0b064f984a9448e3f
parent5c3a4cdc53639f08929f3400b26e01e28f175bd2 (diff)
downloadlinux-stable-23ac2a31c54f5bb39d6e11c47680e588b3a0ca81.tar.gz
linux-stable-23ac2a31c54f5bb39d6e11c47680e588b3a0ca81.tar.bz2
linux-stable-23ac2a31c54f5bb39d6e11c47680e588b3a0ca81.zip
pstore/zone: Use GFP_ATOMIC to allocate zone buffer
commit 99b3b837855b987563bcfb397cf9ddd88262814b upstream. 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: 335426c6dcdd ("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 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/pstore/zone.c2
1 files changed, 1 insertions, 1 deletions
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;