Skip to content

Commit

Permalink
pstore: add vmalloc error check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Geliang Tang authored and Tony Luck committed Oct 21, 2015
1 parent 7379047 commit 549b39a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/pstore/pmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; ) {
Expand Down

0 comments on commit 549b39a

Please sign in to comment.