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>
This commit is contained in:
Родитель
7379047d55
Коммит
549b39a9e7
|
@ -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; ) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче