diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2017-06-02 13:51:56 +0000 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-06-05 17:50:37 +0200 |
commit | fb153dc53f0eb8e8ad6a69f773e44c2d12daa5d0 (patch) | |
tree | b06ee3b776458a7a69fcf9d501b4c1281d86d905 /drivers/firmware/efi/capsule-loader.c | |
parent | 3c2993b8c6143d8a5793746a54eba8f86f95240f (diff) | |
download | linux-fb153dc53f0eb8e8ad6a69f773e44c2d12daa5d0.tar.bz2 |
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: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Matt 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.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/capsule-loader.c')
-rw-r--r-- | drivers/firmware/efi/capsule-loader.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/firmware/efi/capsule-loader.c b/drivers/firmware/efi/capsule-loader.c index 9ae6c116c474..91e91f7a8807 100644 --- a/drivers/firmware/efi/capsule-loader.c +++ b/drivers/firmware/efi/capsule-loader.c @@ -113,7 +113,7 @@ static ssize_t efi_capsule_submit_update(struct capsule_info *cap_info) VM_MAP, PAGE_KERNEL); if (!cap_hdr_temp) { pr_debug("%s: vmap() failed\n", __func__); - return -EFAULT; + return -ENOMEM; } 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, kbuff = kmap(page); if (!kbuff) { pr_debug("%s: kmap() failed\n", __func__); - ret = -EFAULT; + ret = -ENOMEM; goto failed; } kbuff += PAGE_SIZE - cap_info->page_bytes_remain; |