From: Geliang Tang Date: Tue, 20 Oct 2015 07:39:01 +0000 (-0700) Subject: pstore: add vmalloc error check X-Git-Tag: Ubuntu-5.4-5.4.0-11.14~11335^2~5 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=549b39a9e7ef3eee2d0895530f277c012abc7b43;p=mirror_ubuntu-focal-kernel.git pstore: add vmalloc error check If vmalloc fails, make write_pmsg return -ENOMEM. Signed-off-by: Geliang Tang Acked-by: Kees Cook Signed-off-by: Tony Luck --- diff --git a/fs/pstore/pmsg.c b/fs/pstore/pmsg.c index feb5dd2948b4..5a2f05a16c1e 100644 --- a/fs/pstore/pmsg.c +++ b/fs/pstore/pmsg.c @@ -37,6 +37,8 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf, if (buffer_size > PMSG_MAX_BOUNCE_BUFFER_SIZE) buffer_size = PMSG_MAX_BOUNCE_BUFFER_SIZE; buffer = vmalloc(buffer_size); + if (!buffer) + return -ENOMEM; mutex_lock(&pmsg_lock); for (i = 0; i < count; ) {