]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.8-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Aug 2020 12:56:34 +0000 (14:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Aug 2020 12:56:34 +0000 (14:56 +0200)
added patches:
firmware_loader-efi-firmware-loader-must-handle-pre-allocated-buffer.patch

queue-5.8/firmware_loader-efi-firmware-loader-must-handle-pre-allocated-buffer.patch [new file with mode: 0644]
queue-5.8/series

diff --git a/queue-5.8/firmware_loader-efi-firmware-loader-must-handle-pre-allocated-buffer.patch b/queue-5.8/firmware_loader-efi-firmware-loader-must-handle-pre-allocated-buffer.patch
new file mode 100644 (file)
index 0000000..7d55d6b
--- /dev/null
@@ -0,0 +1,38 @@
+From 4fb60b158afd3ac9e0fe9975aa476213f5cc0a4d Mon Sep 17 00:00:00 2001
+From: Kees Cook <keescook@chromium.org>
+Date: Fri, 24 Jul 2020 14:36:24 -0700
+Subject: firmware_loader: EFI firmware loader must handle pre-allocated buffer
+
+From: Kees Cook <keescook@chromium.org>
+
+commit 4fb60b158afd3ac9e0fe9975aa476213f5cc0a4d upstream.
+
+The EFI platform firmware fallback would clobber any pre-allocated
+buffers. Instead, correctly refuse to reallocate when too small (as
+already done in the sysfs fallback), or perform allocation normally
+when needed.
+
+Fixes: e4c2c0ff00ec ("firmware: Add new platform fallback mechanism and firmware_request_platform()")
+Cc: stable@vger.kernel.org
+Acked-by: Scott Branden <scott.branden@broadcom.com>
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Link: https://lore.kernel.org/r/20200724213640.389191-4-keescook@chromium.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/base/firmware_loader/fallback_platform.c |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/base/firmware_loader/fallback_platform.c
++++ b/drivers/base/firmware_loader/fallback_platform.c
+@@ -25,7 +25,10 @@ int firmware_fallback_platform(struct fw
+       if (rc)
+               return rc; /* rc == -ENOENT when the fw was not found */
+-      fw_priv->data = vmalloc(size);
++      if (fw_priv->data && size > fw_priv->allocated_size)
++              return -ENOMEM;
++      if (!fw_priv->data)
++              fw_priv->data = vmalloc(size);
+       if (!fw_priv->data)
+               return -ENOMEM;
index 0a68de9ec5971a7dc8a2b641680d9288e0bdcdd9..1d9681c7e8e49da47ba7003916ccbc26ed249876 100644 (file)
@@ -449,3 +449,4 @@ arm-dts-exynos-extend-all-exynos5800-a15-s-opps-with-max-voltage-data.patch
 arm-8992-1-fix-unwind_frame-for-clang-built-kernels.patch
 firmware-qcom_scm-fix-legacy-convention-scm-accessors.patch
 irqdomain-treewide-free-firmware-node-after-domain-removal.patch
+firmware_loader-efi-firmware-loader-must-handle-pre-allocated-buffer.patch