提交 549b39a9 编写于 作者: G Geliang Tang 提交者: Tony Luck

pstore: add vmalloc error check

If vmalloc fails, make write_pmsg return -ENOMEM.
Signed-off-by: NGeliang Tang <geliangtang@163.com>
Acked-by: NKees Cook <keescook@chromium.org>
Signed-off-by: NTony Luck <tony.luck@intel.com>
上级 7379047d
...@@ -37,6 +37,8 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf, ...@@ -37,6 +37,8 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf,
if (buffer_size > PMSG_MAX_BOUNCE_BUFFER_SIZE) if (buffer_size > PMSG_MAX_BOUNCE_BUFFER_SIZE)
buffer_size = PMSG_MAX_BOUNCE_BUFFER_SIZE; buffer_size = PMSG_MAX_BOUNCE_BUFFER_SIZE;
buffer = vmalloc(buffer_size); buffer = vmalloc(buffer_size);
if (!buffer)
return -ENOMEM;
mutex_lock(&pmsg_lock); mutex_lock(&pmsg_lock);
for (i = 0; i < count; ) { for (i = 0; i < count; ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册