summaryrefslogtreecommitdiffstats
path: root/fs/pstore
diff options
context:
space:
mode:
authorGeliang Tang <geliangtang@163.com>2015-10-20 00:39:01 -0700
committerTony Luck <tony.luck@intel.com>2015-10-21 09:27:10 -0700
commit549b39a9e7ef3eee2d0895530f277c012abc7b43 (patch)
tree742b9ce0b00b89b861b21c7c336bc848c5734a99 /fs/pstore
parent7379047d5585187d1288486d4627873170d0005a (diff)
downloadop-kernel-dev-549b39a9e7ef3eee2d0895530f277c012abc7b43.zip
op-kernel-dev-549b39a9e7ef3eee2d0895530f277c012abc7b43.tar.gz
pstore: add vmalloc error check
If vmalloc fails, make write_pmsg return -ENOMEM. Signed-off-by: Geliang Tang <geliangtang@163.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'fs/pstore')
-rw-r--r--fs/pstore/pmsg.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/pstore/pmsg.c b/fs/pstore/pmsg.c
index feb5dd2..5a2f05a 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; ) {
OpenPOWER on IntegriCloud