Commit fb153dc5 authored by Jan Kiszka's avatar Jan Kiszka Committed by Ingo Molnar

efi/capsule: Fix return code on failing kmap/vmap

If kmap or vmap fail, it means we ran out of memory. There are no
user-provided addressed involved that would justify EFAULT.
Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: default avatarMatt Fleming <matt@codeblueprint.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20170602135207.21708-3-ard.biesheuvel@linaro.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 3c2993b8
...@@ -113,7 +113,7 @@ static ssize_t efi_capsule_submit_update(struct capsule_info *cap_info) ...@@ -113,7 +113,7 @@ static ssize_t efi_capsule_submit_update(struct capsule_info *cap_info)
VM_MAP, PAGE_KERNEL); VM_MAP, PAGE_KERNEL);
if (!cap_hdr_temp) { if (!cap_hdr_temp) {
pr_debug("%s: vmap() failed\n", __func__); pr_debug("%s: vmap() failed\n", __func__);
return -EFAULT; return -ENOMEM;
} }
ret = efi_capsule_update(cap_hdr_temp, cap_info->pages); ret = efi_capsule_update(cap_hdr_temp, cap_info->pages);
...@@ -185,7 +185,7 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff, ...@@ -185,7 +185,7 @@ static ssize_t efi_capsule_write(struct file *file, const char __user *buff,
kbuff = kmap(page); kbuff = kmap(page);
if (!kbuff) { if (!kbuff) {
pr_debug("%s: kmap() failed\n", __func__); pr_debug("%s: kmap() failed\n", __func__);
ret = -EFAULT; ret = -ENOMEM;
goto failed; goto failed;
} }
kbuff += PAGE_SIZE - cap_info->page_bytes_remain; kbuff += PAGE_SIZE - cap_info->page_bytes_remain;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment